This is another commit to mostly version the code. There have been a considerable number of changes and there is functionality that I am still determining whether it should lie within the manager or the model class itself. It makes the most sense to possibly add the "Update" or database manipulation functions on the models themselves. On the other hand, instead of creating and generating the ID in the model, the current design is to create the entry in the database first, get the last insert row ID and create a new and complete model that is returned back by the function. This allows us to leverage the autoincrement functionality of the database rather than trying to design a function and/ or make an additional call to the database. **NOTE: Code is non-functional due to some classes not having their errors resolved.
68 lines
1.5 KiB
C#
68 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Ophelias.Models;
|
|
using Ophelias.Managers;
|
|
|
|
namespace Ophelias.Models
|
|
{
|
|
internal class Reservation
|
|
{
|
|
internal int Id;
|
|
internal int RoomId;
|
|
internal int GuestId;
|
|
internal int TransactionId;
|
|
|
|
internal bool IsNoShow;
|
|
|
|
internal ReservationType Type;
|
|
internal ReservationStatus Status;
|
|
|
|
internal DateTime CreationDate;
|
|
internal DateTime StartDate;
|
|
internal DateTime EndDate;
|
|
|
|
internal DateTime? CheckIn;
|
|
internal DateTime? CheckOut;
|
|
internal DateTime? DateChanged;
|
|
|
|
internal Reservation(int id, int gid, int tid, int room, ReservationType type, ReservationStatus status,
|
|
DateTime startdate, DateTime enddate)
|
|
{
|
|
Id = id;
|
|
RoomId = room;
|
|
GuestId = gid;
|
|
TransactionId = tid;
|
|
|
|
IsNoShow = false;
|
|
|
|
Type = type;
|
|
Status = status;
|
|
|
|
CreationDate = DateTime.Now;
|
|
StartDate = startdate;
|
|
EndDate = enddate;
|
|
|
|
CheckIn = null;
|
|
CheckOut = null;
|
|
DateChanged = null;
|
|
}
|
|
}
|
|
internal enum ReservationStatus
|
|
{
|
|
Active,
|
|
Changed,
|
|
Cancelled,
|
|
Ended,
|
|
}
|
|
internal enum ReservationType
|
|
{
|
|
Conventional,
|
|
Prepaid,
|
|
Incentive,
|
|
SixtyDayAdvance,
|
|
}
|
|
}
|