public static String ViewFreeTablesHall(String hallId, String date, String time) { #region Находим список забранированных столов на необходимый день ReservedTablesMapper reservedTablesMapper = new ReservedTablesMapper(); DayMapper dayMapper = new DayMapper(); List <int> busyTables = new List <int>(); date = date.Substring(6, 4) + "-" + date.Substring(3, 2) + "-" + date.Substring(0, 2); int idDay = dayMapper.GetDayId(date); // id даты бронирования busyTables.AddRange(reservedTablesMapper.GetBusyTables(idDay.ToString())); #endregion #region Список всех столов в зале HallMapper hallMapper = new HallMapper(); List <int> tablesInHall = new List <int>(); tablesInHall.AddRange(hallMapper.GetTablesInHall(hallId)); #endregion #region Свободные столы в зале foreach (var table in busyTables) { tablesInHall.Remove(table); } #endregion String cookieString = tablesInHall.Aggregate("", (current, table) => current + (table + " ")); cookieString = cookieString.Substring(0, cookieString.Length - 1); return(cookieString); }
public static String InsertInformationOrder(String name, String phone, String table, String time, String date) { DayMapper dayMapper = new DayMapper(); date = date.Substring(6, 4) + "-" + date.Substring(3, 2) + "-" + date.Substring(0, 2); int idDay = dayMapper.GetDayId(date); // id даты бронирования ReservedTablesMapper reservedTablesMapper = new ReservedTablesMapper(); //time = time.Replace(':', '.'); String idOrder = reservedTablesMapper.ReserveTable(name, phone, table, time, idDay); return(idOrder); }