public List <AdminRequiredData> QueueTransaction(DateTime fromDate, DateTime toDate) { try { HotelBookingDBEntities BookingDB = new HotelBookingDBEntities(); // SearchDBEntities searchDB = new SearchDBEntities(); List <AdminRequiredData> requiredData = new List <AdminRequiredData>(); toDate = toDate.AddDays(1); var ListSearchData = BookingDB.HotelsBookings.Where(a => a.Booking_Time.Value <= toDate && a.Booking_Time.Value >= fromDate).ToList(); foreach (var item in ListSearchData) { AdminRequiredData adminData = new AdminRequiredData(); adminData.bookingNumber = item.Booking_No; adminData.creationDate = item.Booking_Time.Value; adminData.customerEmail = item.Booking_Email; adminData.proveider = item.Provider_ID; adminData.status = item.Booking_Status; requiredData.Add(adminData); } return(requiredData); } catch (Exception ex) { LoggingHelper.WriteToFile("AdminPannelController/ERROR/", "QueueTransactionController" + "INDAL", "Data", "from is " + fromDate + " and to is" + toDate + ex.InnerException?.Message + ex.Message + ex.StackTrace); return(new List <AdminRequiredData>()); } }
public List <AdminRequiredData> GetHotelAdimSearchData(string Key) { try { HotelBookingDBEntities BookingDB = new HotelBookingDBEntities(); SearchDBEntities searchDB = new SearchDBEntities(); List <AdminRequiredData> requiredData = new List <AdminRequiredData>(); var ListSearchData = BookingDB.HotelsBookings.Where(a => a.Booking_No.ToLower().Contains(Key.ToLower()) || a.Booking_Email.ToLower().Contains(Key.ToLower()) || a.Booking_Status.ToLower().Contains(Key.ToLower())).ToList(); foreach (var item in ListSearchData) { AdminRequiredData adminData = new AdminRequiredData(); adminData.bookingNumber = item.Booking_No; adminData.creationDate = item.Booking_Time.Value; adminData.customerEmail = item.Booking_Email; adminData.proveider = item.Provider_ID; adminData.status = item.Booking_Status; var Criteria = searchDB.SearchCriterias.FirstOrDefault(x => x.sID == item.SessionId); adminData.checkin = Criteria.dateFrom.Value; adminData.checkout = Criteria.dateTo.Value; var Names = item.Pax_Name.Split(' '); adminData.LeadFirstName = Names[0]; adminData.LeadLastName = Names[1]; adminData.Price = item.Sell_Price.Value; adminData.Currency = item.Sell_Currency; if (item.Provider_ID == "4") { adminData.proveiderName = "HotelBeds"; } else if (item.Provider_ID == "2") { adminData.proveiderName = "Total Stay"; } requiredData.Add(adminData); } return(requiredData); } catch (Exception ex) { LoggingHelper.WriteToFile("AdminPannelController/ERROR/", "HotelAdminSearchController" + "INDAL" + Key, "Data", "key is " + Key + " and key is" + Key + ex.InnerException?.Message + ex.Message + ex.StackTrace); return(new List <AdminRequiredData>()); } }