public LocationSeatTypeConfig(SeatTypeConfig SeatTypeConfig, string Code, string Name, bool IsCloseWindow = false) : base(Code, Name) { this.IsCloseWindow = IsCloseWindow; this.SeatTypeConfig = SeatTypeConfig; SeatTypeConfig.AddLocationSeatTypeConfig(this); }
public TrainSeatPrice(TrainTicketPrice TrainTicketPrice, SeatTypeConfig SeatType, decimal Price, bool IsDefault) : base() { this.TrainTicketPrice = TrainTicketPrice; this.SeatType = SeatType; this.Price = Price; this.IsDefault = IsDefault; this.TrainTicketPrice.AddTrainSeatPrice(this); }
public Seat(TrainCarriage TrainCarriage, int Row, string Code, SeatTypeConfig SeatType) : base() { this.TrainCarriage = TrainCarriage; this.Row = Row; this.Code = Code; this.SeatType = SeatType; TrainCarriage.AddSeat(this); }
public TrainSeatPrice(SeatTypeConfig SeatType, decimal Price, bool IsDefault = false) { this.SeatType = SeatType; this.Price = Price; this.IsDefault = IsDefault; AddTime = DateTimeOffset.Now; UpdateTime = DateTimeOffset.Now; AddUserId = UserHelper.User.Id; UpdateUserId = UserHelper.User.Id; }
private static bool isEqual(SeatTypeConfig left, SeatTypeConfig right) { var a = ReferenceEquals(left, null); var b = ReferenceEquals(right, null); if (a ^ b) { return(false); } var c = ReferenceEquals(left, null); var d = left.Equals(right); return(c || d); }
public Seat(TrainCarriage TrainCarriage, int Row, string Code, SeatTypeConfig SeatType) { base.Id = Guid.NewGuid(); this.TrainCarriage = TrainCarriage; this.Row = Row; this.Code = Code; this.SeatType = SeatType; AddTime = DateTimeOffset.Now; UpdateTime = DateTimeOffset.Now; AddUserId = UserHelper.User.Id; UpdateUserId = UserHelper.User.Id; TrainCarriage.AddSeat(this); }
public decimal GetTrainStationWayPrice(TrainStationWay TrainStationWay, SeatTypeConfig SeatType, ContractUserType TicketUserType = ContractUserType.Adult) { if (TrainStationWay == null) { throw new ArgumentNullException("TrainStationWay"); } decimal price = 0; decimal decutPrice = 0; var list = TrainTicketPrices.Where(o => o.StartTrainStation >= TrainStationWay.StartTrainStation && o.EndTrainStation <= TrainStationWay.EndTrainStation); foreach (var item in list) { var trainSeatPrices = item.TrainSeatPrices.Where(o => o.SeatType == SeatType).FirstOrDefault(); if (trainSeatPrices == null) { throw new Exception($"车次{Code} {item}未配置{SeatType.Name}座位类型"); } price += trainSeatPrices.Price; if (TicketUserType == ContractUserType.Children) { decutPrice += trainSeatPrices.Price / 2; } if (TicketUserType == ContractUserType.Student) { var defaultTrainSeatPrice = item.TrainSeatPrices.Where(o => o.IsDefault).FirstOrDefault(); if (defaultTrainSeatPrice == null) { throw new Exception($"车次{Code} {item}"); } decutPrice += defaultTrainSeatPrice.Price; } } price -= decutPrice; //待处理学生价格 return(price); }
public (bool, string, TrainOrder) BookTrainTicket(TrainShift TrainShift, TrainStation StartTrainStation, TrainStation EndTrainStation, SeatTypeConfig SeatType, CustomerInfo CustomerInfo, UserContract UserContract) { return(BookTrainTicket(TrainShift, StartTrainStation, EndTrainStation, new List <SeatTypeConfig> { SeatType }, CustomerInfo, UserContract)); }
public TrainSeatPrice(TrainTicketPrice TrainTicketPrice, SeatTypeConfig SeatType, decimal Price) : this(TrainTicketPrice, SeatType, Price, false) { }