move from Yavsc
This commit is contained in:
43
Yavsc.Server/Interfaces/ICalendarManager.cs
Normal file
43
Yavsc.Server/Interfaces/ICalendarManager.cs
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// ICalendarManager.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// Copyright (c) 2015 GNU GPL
|
||||
//
|
||||
// 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 Google.Apis.Calendar.v3.Data;
|
||||
|
||||
namespace Yavsc.Services
|
||||
{
|
||||
using System.Threading.Tasks;
|
||||
using Yavsc.ViewModels.Calendar;
|
||||
|
||||
/// <summary>
|
||||
/// I calendar manager.
|
||||
/// </summary>
|
||||
public interface ICalendarManager {
|
||||
Task<CalendarList> GetCalendarsAsync (string userId, string pageToken);
|
||||
Task<Events> GetCalendarAsync (string calid, DateTime minDate, DateTime maxDate, string pageToken);
|
||||
Task<DateTimeChooserViewModel> CreateViewModelAsync(
|
||||
string inputId,
|
||||
string calid, DateTime mindate, DateTime maxdate);
|
||||
Task<Event> CreateEventAsync(string userId, string calid,
|
||||
DateTime startDate, int lengthInSeconds, string summary,
|
||||
string description, string location, bool available);
|
||||
}
|
||||
}
|
53
Yavsc.Server/Interfaces/IFreeDateSet.cs
Normal file
53
Yavsc.Server/Interfaces/IFreeDateSet.cs
Normal file
@ -0,0 +1,53 @@
|
||||
// FreeDate.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.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Free date.
|
||||
/// </summary>
|
||||
public interface IFreeDateSet
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the reference.
|
||||
/// </summary>
|
||||
/// <value>The reference.</value>
|
||||
IEnumerable<Period> Values { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the duration.
|
||||
/// </summary>
|
||||
/// <value>The duration.</value>
|
||||
TimeSpan Duration { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the attendees.
|
||||
/// </summary>
|
||||
/// <value>The attendees.</value>
|
||||
string UserName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the location.
|
||||
/// </summary>
|
||||
/// <value>The location.</value>
|
||||
string Location { get; set; }
|
||||
}
|
||||
}
|
||||
|
34
Yavsc.Server/Interfaces/IScheduledEvent.cs
Normal file
34
Yavsc.Server/Interfaces/IScheduledEvent.cs
Normal file
@ -0,0 +1,34 @@
|
||||
//
|
||||
// IScheduledEvent.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 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/>.
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
public interface IScheduledEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the period.
|
||||
/// </summary>
|
||||
/// <value>The period.</value>
|
||||
Periodicity Reccurence { get; set; }
|
||||
Period Period { get; set; }
|
||||
|
||||
}
|
||||
}
|
52
Yavsc.Server/Models/Calendar/Period.cs
Normal file
52
Yavsc.Server/Models/Calendar/Period.cs
Normal file
@ -0,0 +1,52 @@
|
||||
//
|
||||
// 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.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Hollydays.
|
||||
/// </summary>
|
||||
public class Period {
|
||||
/// <summary>
|
||||
/// Gets or sets the start.
|
||||
/// </summary>
|
||||
/// <value>The start.</value>
|
||||
[Required,Display(Name="Début")]
|
||||
public DateTime Start { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the end.
|
||||
/// </summary>
|
||||
/// <value>The end.</value>
|
||||
[Required,Display(Name="Fin")]
|
||||
public DateTime End { get; set; }
|
||||
|
||||
public static Period operator ^ (Period foo, Period bar) {
|
||||
var min = ( DateTime.Compare(foo.Start, bar.Start) > 0 ) ? foo.Start : bar.Start;
|
||||
var max = ( DateTime.Compare(bar.End, foo.End) > 0 ) ? foo.End : bar.End;
|
||||
if (DateTime.Compare(max, min)>0) return new Period { Start = min, End = max };
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
59
Yavsc.Server/Models/Calendar/Periodicity.cs
Normal file
59
Yavsc.Server/Models/Calendar/Periodicity.cs
Normal file
@ -0,0 +1,59 @@
|
||||
//
|
||||
// Periodicity.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 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/>.
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
/// <summary>
|
||||
/// Periodicity.
|
||||
/// </summary>
|
||||
public enum Periodicity {
|
||||
|
||||
/// <summary>
|
||||
/// On Demand.
|
||||
/// </summary>
|
||||
OnDemand=-1,
|
||||
/// <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
|
||||
}
|
||||
|
||||
}
|
45
Yavsc.Server/Models/Calendar/ScheduledEvent.cs
Normal file
45
Yavsc.Server/Models/Calendar/ScheduledEvent.cs
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// ScheduledEvent.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 - 2017 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.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
public class ScheduledEvent : IScheduledEvent
|
||||
{
|
||||
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public long Id { get; set; }
|
||||
public Period Period
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
|
||||
public Periodicity Reccurence
|
||||
{
|
||||
get;
|
||||
|
||||
set;
|
||||
}
|
||||
}
|
||||
}
|
58
Yavsc.Server/Models/Calendar/WeekDay.cs
Normal file
58
Yavsc.Server/Models/Calendar/WeekDay.cs
Normal file
@ -0,0 +1,58 @@
|
||||
//
|
||||
// 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/>.
|
||||
|
||||
namespace Yavsc.Models.Calendar
|
||||
{
|
||||
/// <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
|
||||
}
|
||||
|
||||
}
|
19
Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs
Normal file
19
Yavsc.Server/ViewModels/Calendar/DateTimeChooserViewModel.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Yavsc.Models.Calendar;
|
||||
|
||||
|
||||
namespace Yavsc.ViewModels.Calendar
|
||||
{
|
||||
public class DateTimeChooserViewModel
|
||||
{
|
||||
public string InputId { get; set; }
|
||||
public DateTime MinDate { get; set; }
|
||||
public DateTime MaxDate { get; set; }
|
||||
public Period [] Busy { get; set; }
|
||||
public Period [] Free { get; set; }
|
||||
|
||||
public string [] FreeDates { get ; set; }
|
||||
public string [] BusyDates { get ; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
|
||||
using Google.Apis.Calendar.v3.Data;
|
||||
|
||||
namespace Yavsc.ViewModels.Calendar
|
||||
{
|
||||
public class SetGoogleCalendarViewModel
|
||||
{
|
||||
public string GoogleCalendarId { get; set; }
|
||||
|
||||
public string ReturnUrl { get; set; }
|
||||
|
||||
public CalendarList Calendars { get; set; }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
|
||||
namespace Yavsc.ViewModels.Calendar {
|
||||
public class UpcomingEventsViewModel {
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user