move from Yavsc

This commit is contained in:
Paul Schneider 2018-05-07 11:40:27 +02:00
commit 24ee910008
22 changed files with 0 additions and 0 deletions

View 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;
}
}
}

View 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
}
}

View 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;
}
}
}

View 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
}
}