events refactoring

This commit is contained in:
Paul Schneider 2016-09-17 03:36:34 +02:00
commit d11fed8d32
13 changed files with 98 additions and 89 deletions

View file

@ -18,29 +18,22 @@ namespace Yavsc.Models.Booking
[Display(Name="Event date")]
public DateTime EventDate{
get
{ return ((RendezVous)Bill[0]).EventDate; }
set { ((RendezVous)Bill[0]).EventDate = value; }
get;
set;
}
public Location Location {
get
{ return ((RendezVous)Bill[0]).Location; }
set { ((RendezVous)Bill[0]).Location = value; }}
get;
set;
}
public BookQuery()
{
this.Bill.Add(new RendezVous());
}
public BookQuery(Location eventLocation, DateTime eventDate)
{
this.Bill.Add(new RendezVous{
Location = eventLocation,
EventDate = eventDate
});
}
public string GetDescription() {
return $"{Location?.Address} {EventDate.ToString()}";
Location = eventLocation;
EventDate = eventDate;
}
}
}

View file

@ -30,13 +30,6 @@ namespace Yavsc.Models.Calendar
/// Provided event.
/// </summary>
public class ProvidedEvent : YaEvent {
public ProvidedEvent(string topic) : base(topic)
{
}
/// <summary>
/// The privacy.
/// </summary>

View file

@ -27,7 +27,23 @@ namespace Yavsc.Models.Messaging
/// <summary>
/// Base event.
/// </summary>
public class BaseEvent: ITitle
public class BaseEvent : IEvent {
public BaseEvent()
{
Topic = GetType().Name;
}
public BaseEvent(string topic)
{
Topic = topic;
}
public string Topic { get; set; }
public string Sender { get; set; }
public string Message { get; set; }
}
public class GeneralEvent: BaseEvent, ITitle
{
/// <summary>
/// The title.

View file

@ -1,8 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Messaging
{
using Yavsc.Model;
//
// BookQueryEvent.cs
@ -25,31 +24,27 @@ namespace Yavsc.Models.Messaging
// 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/>.
public class BookQueryEvent: YaEvent
public class BookQueryEvent: BookQueryProviderView, IEvent
{
public BookQueryEvent() : base("BookQuery")
public BookQueryEvent()
{
Topic = "BookQuery";
}
/// <summary>
/// The location.
/// </summary>
[Display(Name="Location")]
public Location Location { get; set; }
/// <summary>
/// The start date.
/// </summary>
[Display(Name="StartDate")]
public DateTime StartDate { get; set; }
/// <summary>
/// Gets or sets the end date.
/// </summary>
/// <value>The end date.</value>
[Display(Name="EndDate")]
public DateTime EndDate { get; set; }
public string Message
{
get; set;
}
public long CommandId { get; set; }
}
public string Sender
{
get; set;
}
public string Topic
{
get; set;
}
}
}

View file

@ -29,11 +29,6 @@ namespace Yavsc.Models.Messaging
/// </summary>
public class CircleEvent: YaEvent
{
public CircleEvent(string topic) : base(topic)
{
}
/// <summary>
/// Gets or sets the circles.
/// </summary>

View file

@ -0,0 +1,21 @@
using System;
namespace Yavsc.Model
{
public class BookQueryProviderView { 
public ClientProviderView Client { get; set; }
public Location Location { get; set; }
public long Id { get; set; }
public DateTime EventDate { get ; set; }
public decimal? Previsional { get; set; }
}
public class ClientProviderView { 
public string UserName { get; set; }
public string UserId { get; set; }
public int Rate { get; set; }
}
}

View file

@ -28,24 +28,12 @@ namespace Yavsc.Models.Messaging
/// </summary>
public class YaEvent : BaseEvent
{
public YaEvent(string topic)
{
Topic = topic;
}
/// <summary>
/// The topic.
/// </summary>
public string Topic { get; set; }
/// <summary>
/// The NF provider identifier.
/// </summary>
[Display(Name="ProviderId")]
public string ProviderId { get; set; }
/// <summary>
/// The promotion code.
/// </summary>
[Display(Name="Comment")]
public string Comment { get; set; }
[Display(Name="From")]
public string FromUserName { get; set; }
/// <summary>
/// The event web page.
/// </summary>