refactoring

This commit is contained in:
Paul Schneider
2015-06-06 19:34:34 +02:00
parent 71f0d756b3
commit d327f4d77e
18 changed files with 91 additions and 96 deletions

View File

@ -0,0 +1,45 @@
//
// EventPub.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.ApiControllers.Calendar.Model;
using Yavsc.Model;
using Yavsc.Model.RolesAndMembers;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Event pub.
/// </summary>
public class EventPub: YaEvent
{
/// <summary>
/// Gets or sets the circles.
/// </summary>
/// <value>The circles.</value>
[Display(ResourceType=typeof(LocalizedText),Name="Circles")]
public Circle[] Circles { get; set; }
}
}

View File

@ -0,0 +1,61 @@
//
// OpenDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Open day.
/// </summary>
public class OpenDay {
/// <summary>
/// The day.
/// </summary>
[Required]
public WeekDay Day;
/// <summary>
/// Gets or sets the s.
/// </summary>
/// <value>The s.</value>
public TimeSpan S { get; set; }
// ASSERT Start <= End
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start.</value>
[Required]
public TimeSpan Start { get; set; }
/// <summary>
/// Gets or sets the end hour
/// (from the next day if lower than the Start).
/// </summary>
/// <value>The end.</value>
[Required]
public TimeSpan End { get; set; }
}
}

View File

@ -0,0 +1,46 @@
//
// Period.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Hollydays.
/// </summary>
public class Period {
/// <summary>
/// Gets or sets the start.
/// </summary>
/// <value>The start.</value>
[Required]
public DateTime Start { get; set; }
/// <summary>
/// Gets or sets the end.
/// </summary>
/// <value>The end.</value>
[Required]
public DateTime End { get; set; }
}
}

View File

@ -0,0 +1,58 @@
//
// Periodicity.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Periodicity.
/// </summary>
public enum Periodicity {
/// <summary>
/// The daily.
/// </summary>
Daily,
/// <summary>
/// The weekly.
/// </summary>
Weekly,
/// <summary>
/// The monthly.
/// </summary>
Monthly,
/// <summary>
/// The three m.
/// </summary>
ThreeM,
/// <summary>
/// The six m.
/// </summary>
SixM,
/// <summary>
/// The yearly.
/// </summary>
Yearly
}
}

View File

@ -0,0 +1,44 @@
//
// Position.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Position.
/// </summary>
public class Position
{
/// <summary>
/// The longitude.
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// The latitude.
/// </summary>
public double Latitude { get; set; }
}
}

View File

@ -0,0 +1,42 @@
//
// PositionAndKeyphrase.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Position and keyphrase.
/// </summary>
public class PositionAndKeyphrase {
/// <summary>
/// The phrase.
/// </summary>
public string phrase;
/// <summary>
/// The position.
/// </summary>
public Position pos;
}
}

View File

@ -0,0 +1,41 @@
//
// ProvidedEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.Model.RolesAndMembers;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Provided event.
/// </summary>
public class ProvidedEvent : YaEvent {
/// <summary>
/// The privacy.
/// </summary>
[Required]
public Publishing Privacy;
}
}

View File

@ -0,0 +1,52 @@
//
// Schedule.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Schedule.
/// </summary>
public class Schedule {
/// <summary>
/// Gets or sets the period.
/// </summary>
/// <value>The period.</value>
public Periodicity Period { get; set; }
/// <summary>
/// Gets or sets the schedule of an open week.
/// One item by bay in the week,
/// </summary>
/// <value>The weekly workdays.</value>
public OpenDay [] WeekDays { get; set; }
/// <summary>
/// Gets or sets the hollydays.
/// </summary>
/// <value>The hollydays.</value>
[Required]
public Period [] Validity { get; set; }
}
}

View File

@ -0,0 +1,62 @@
//
// WeekDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// Week day.
/// </summary>
public enum WeekDay:int {
/// <summary>
/// The monday (0).
/// </summary>
Monday=0,
/// <summary>
/// The tuesday.
/// </summary>
Tuesday,
/// <summary>
/// The wednesday.
/// </summary>
Wednesday,
/// <summary>
/// The thursday.
/// </summary>
Thursday,
/// <summary>
/// The friday.
/// </summary>
Friday,
/// <summary>
/// The saturday.
/// </summary>
Saturday,
/// <summary>
/// The sunday.
/// </summary>
Sunday
}
}

View File

@ -0,0 +1,96 @@
//
// NFEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.Model;
namespace Yavsc.ApiControllers.Calendar.Model
{
/// <summary>
/// NF event.
/// </summary>
public class YaEvent
{
/// <summary>
/// The title.
/// </summary>
[Required(ErrorMessage="Please, choose a .")]
[Display(ResourceType=typeof(LocalizedText),Name="Title")]
public string Title { get; set; }
/// <summary>
/// The description.
/// </summary>
[Required(ErrorMessage="Please, choose a Description.")]
[Display(ResourceType=typeof(LocalizedText),Name="Description")]
public string Description { get; set; }
/// <summary>
/// The location.
/// </summary>
[Required(ErrorMessage="Please, choose a Location.")]
[Display(ResourceType=typeof(LocalizedText),Name="Location")]
public Position Location { get; set; }
/// <summary>
/// The start date.
/// </summary>
[Required(ErrorMessage="Please, choose a Start Date.")]
[Display(ResourceType=typeof(LocalizedText),Name="StartDate")]
public DateTime StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
[Required(ErrorMessage="Please, choose an End Date.")]
[Display(ResourceType=typeof(LocalizedText),Name="EndDate")]
public DateTime EndDate { get; set; }
/// <summary>
/// The name of the NF provider.
/// </summary>
[Required(ErrorMessage="Please, choose a Provider Name.")]
[Display(ResourceType=typeof(LocalizedText),Name="ProviderName")]
public string ProviderName { get; set; }
/// <summary>
/// The NF provider identifier.
/// </summary>
[Required(ErrorMessage="Please, choose a Provider Identifier.")]
[Display(ResourceType=typeof(LocalizedText),Name="ProviderId")]
public string ProviderId { get; set; }
/// <summary>
/// The promotion code.
/// </summary>
[Display(ResourceType=typeof(LocalizedText),Name="Comment")]
public string Comment { get; set; }
/// <summary>
/// The event web page.
/// </summary>
[Display(ResourceType=typeof(LocalizedText),Name="EventWebPage")]
public string EventWebPage { get; set; }
/// <summary>
/// The image locator.
/// </summary>
[Display(ResourceType=typeof(LocalizedText),Name="ImgLocator")]
public string ImgLocator { get; set; }
}
}

View File

@ -0,0 +1,65 @@
//
// GCMRegisterModel.cs
//
// Author:
// paul <>
//
// Copyright (c) 2015 paul
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.Google
{
/// <summary>
/// GCM register model.
/// </summary>
public class GCMRegisterModel {
/// <summary>
/// Gets or sets the name of the user.
/// </summary>
/// <value>The name of the user.</value>
[Localizable(true)]
[Display(ResourceType=typeof(LocalizedText),Name="UserName")]
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
public string UserName { get; set; }
/// <summary>
/// Gets or sets the password.
/// </summary>
/// <value>The password.</value>
[DisplayName("Mot de passe")]
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
public string Password { get; set; }
/// <summary>
/// Gets or sets the email.
/// </summary>
/// <value>The email.</value>
[DisplayName("Adresse e-mail")]
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
public string Email { get; set; }
/// <summary>
/// Gets or sets the registration identifier against Google Clood Messaging and their info on this application.
/// </summary>
/// <value>The registration identifier.</value>
public string RegistrationId { get; set; }
}
}

View File

@ -0,0 +1,64 @@
//
// Circle.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using System.Collections.Generic;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Circle.
/// </summary>
public class Circle
{
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the users.
/// </summary>
/// <value>The users.</value>
public string [] Users { get; set; }
/// <summary>
/// Union the specified that.
/// </summary>
/// <param name="that">That.</param>
public static string [] Union (Circle []those)
{
List<string> content = new List<string>();
foreach (Circle c in those) {
foreach (string user_name in c.Users) {
if (!content.Contains (user_name))
content.Add (user_name);
}
}
return content.ToArray ();
}
}
}

View File

@ -0,0 +1,74 @@
//
// ProviderPublicInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
using Yavsc.ApiControllers.Calendar.Model;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Provider public info.
/// </summary>
public class ProviderPublicInfo {
/// <summary>
/// Gets or sets the display name.
/// </summary>
/// <value>The display name.</value>
[Required]
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
[Required]
public string LocationType { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
/// <value>The location.</value>
[Required]
public Position Location { get; set; }
/// <summary>
/// Gets or sets the logo image locator.
/// </summary>
/// <value>The logo image locator.</value>
public string LogoImgLocator { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
[Required]
public string Description { get; set;}
/// <summary>
/// Gets or sets the web page.
/// </summary>
/// <value>The web page.</value>
public string WebPage { get; set; }
/// <summary>
/// Gets or sets the calendar.
/// </summary>
/// <value>The calendar.</value>
public Schedule Calendar { get; set; }
}
}

View File

@ -0,0 +1,43 @@
//
// Publishing.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// 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 <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Model.RolesAndMembers
{
/// <summary>
/// Publishing.
/// </summary>
public enum Publishing {
/// <summary>
/// The private.
/// </summary>
Private,
/// <summary>
/// The public.
/// </summary>
Public
}
}

View File

@ -147,6 +147,20 @@
<Compile Include="Google\Messaging\MessageWithPayLoad.cs" />
<Compile Include="Google\Messaging\MessageWithPayloadResponse.cs" />
<Compile Include="Google\Messaging\Notification.cs" />
<Compile Include="Calendar\EventPub.cs" />
<Compile Include="Calendar\OpenDay.cs" />
<Compile Include="Calendar\Period.cs" />
<Compile Include="Calendar\Periodicity.cs" />
<Compile Include="Calendar\Position.cs" />
<Compile Include="Calendar\PositionAndKeyphrase.cs" />
<Compile Include="Calendar\ProvidedEvent.cs" />
<Compile Include="Calendar\Schedule.cs" />
<Compile Include="Calendar\WeekDay.cs" />
<Compile Include="Calendar\YaEvent.cs" />
<Compile Include="RolesAndMemebers\Circle.cs" />
<Compile Include="RolesAndMemebers\Publishing.cs" />
<Compile Include="RolesAndMemebers\ProviderPublicInfo.cs" />
<Compile Include="Google\GCMRegisterModel.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>