|
namespace RegiRide.DesignTime
{
using System;
using System.Collections.Generic;
using System.Windows;
using RegiRide.Model;
using RegiRide.Repository;
public class DesignRideRepository : IRideRepository
{
public List<Ride> GetAll()
{
var rideList = new List<Ride>();
var startDateTime = new DateTime(2011, 1, 1);
var endDatetime = new DateTime(2011, 6, 1);
for (DateTime dateTimeCounter = startDateTime; dateTimeCounter < endDatetime; dateTimeCounter = dateTimeCounter.AddDays(0.5))
{
var ride = new Ride();
ride.Id = Guid.NewGuid();
ride.RideType = (int)RideType.Business;
ride.Date = dateTimeCounter;
ride.Remark = "Remark " + dateTimeCounter.Ticks;
ride.StartMilage = 12001;
ride.EndMilage = 12082;
rideList.Add(ride);
}
return rideList;
}
public Ride GetPreviousState(Ride model)
{
return model;
}
public void Save(Ride ride)
{
}
public Ride CreateNewRide()
{
return new Ride();
}
public void Delete(Ride model)
{
}
public bool IsAddressUsed(Address model)
{
return false;
}
public void DeleteAll()
{
}
public Ride GetRide(Guid addressId)
{
try
{
var ride = new Ride();
ride.Id = Guid.NewGuid();
ride.RideType = (int)RideType.Business;
ride.Date = DateTime.Now;
ride.Remark = "Remark 001";
ride.StartMilage = 12001;
ride.EndMilage = 12082;
//ride.StartAddress = new DesignAddressRepository().GetAddress(Guid.NewGuid());
//ride.EndAddress = new DesignAddressRepository().GetAddress(Guid.NewGuid());
return ride;
}
catch (Exception error)
{
MessageBox.Show(error.Message);
return null;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Patrick Kalkman is a senior Software Architect with more than 20 years professional development experience. He works for
SimpleTechture where he helps teams develop state of the art web applications.
Patrick enjoys writing his
blog. It discusses agile software development. Patrick can be reached at patrick@simpletechture.nl.
Published Windows 8 apps:
Published Windows Phone apps:
Awards:
Best Mobile article of March 2012
Best Mobile article of June 2012