public List <HotelOrderModel> List() { var Today = DateTime.Now; var model = new List <HotelOrderModel>(); using (var db = new MyAnythingEntities()){ model = (from order in db.OrderMaster join room in db.Room on order.ProductId equals room.ID join pay in db.PayGo on order.MerchantOrderNo equals pay.MerchantOrderNo into paygo from x in paygo.DefaultIfEmpty() where RoomID.Contains(room.ID) && (string.IsNullOrEmpty(SearchKey) || (order.Name.Contains(SearchKey) || order.Tel.Contains(SearchKey) || order.MerchantOrderNo.Contains(SearchKey))) select new HotelOrderModel { CheckInDate = order.CheckIn, CheckOutDate = order.CheckOut, ID = order.ID, MerchantOrderNo = order.MerchantOrderNo, OrderTel = order.Tel, OrderName = order.Name, PaymentType = order.PaymentType, PayStatus = (order.ExpireDate != null && order.Status == OrderType.Unpaid.ToString() && DateTime.Compare(order.ExpireDate.Value, Today) < 0)? "超過繳款期限" : (order.Status == OrderType.Paid.ToString() ? "付款完成" : (order.Status == OrderType.Expired.ToString() ? "超過繳款期限" : "未付款")), RoomName = order.ProductName, Created = order.Created, Quantity = order.Quantity, Amt = order.PayAmt, Bonus = order.BonusAmt, OrderAmt = order.Amount }).ToList(); } return(model); }
public async void Message(IPlayer player, string message) { if (player == null) { throw new ArgumentNullException(nameof(player)); } if (string.IsNullOrEmpty(message)) { return; } var args = new object[2]; args[0] = message; args[1] = player.Name; string action; if (RoomID.Contains("LOBBYCHAT")) { action = "MSG|LOBBY"; } else { action = "MSG|TABLE"; } //Loop all players and tell a player left foreach (var roomPlayer in Players) { var encoded = Encoding.UTF8.GetBytes( JsonConvert.SerializeObject(new RoomMessage(player.PlayerId, action, args))); var buffers = new ArraySegment <Byte>(encoded, 0, encoded.Length); await roomPlayer.Socket.SendAsync(buffers, WebSocketMessageType.Text, true, CancellationToken.None) .ConfigureAwait(false); } }