public List<BookingList> loadVehicleList() { dm = new SeyahatIstanbulEntities(); int kId = 1;//Convert.ToInt32(Session["kId"].ToString()); int prodId; List<BookingList> bookingList = new List<BookingList>(); BookingList booking; SettingController set = new SettingController(); var procesesList = (from p in dm.Process where 1 == 1 && p.blStatus == true //yönetici tarafından silinmiş olabilir && (p.rfStatusId == 1 || p.rfStatusId == 2 || p.rfStatusId == 3) && p.dtStartDate >= DateTime.Now && p.rfCustomerId == kId select p).ToList().OrderByDescending(d => d.dtStartDate); foreach (var item in procesesList) { #region Araç prodId = Convert.ToInt32(item.rfProductId); if (item.rfCategoryId == 1) { List<VehicleList> vehicleList = set.loadVehicleList(prodId); VehicleList vh = vehicleList[0]; string place1 = (from p in dm.Address where 1 == 1 && p.rfAddressTypeId == 3 //araç teslim adresi && p.sqAddressId == item.rfDeliveryPlace_1 select p.chValue).ToString(); string place2 = (from p in dm.Address where 1 == 1 && p.rfAddressTypeId == 3 //araç teslim adresi && p.sqAddressId == item.rfDeliveryPlace_2 select p.chValue).ToString(); string chDurum_ = (from ps in dm.ProcessStatus where 1 == 1 && ps.sqProcessStatusId == item.rfStatusId select ps.chValue).ToString(); booking = new BookingList { rfCategoryId = 1, rfProductId = vh.dgVehicleId, sqProcessId = item.sqProcessId, chImageName = "~/Content/img/RentVehicle/" + vh.chImageRoute_2, chProductName = vh.chBrand + " " + vh.chModel + " " + vh.chModelYear, dgTotalPrice = Convert.ToInt32(item.dgPrice), chDeliveryPlace_1 = place1, chDeliveryPlace_2 = place2, dgDurum = Convert.ToInt32(item.rfStatusId), chDurum = chDurum_, dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14), dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14), dtCreated = Convert.ToDateTime(item.dtCreated), imageList = vh.imageList }; bookingList.Add(booking); } #endregion #region Apart if (item.rfCategoryId == 2) { List<ApartList> apartList = set.loadApartList(prodId); string chDurum_ = (from ps in dm.ProcessStatus where 1 == 1 && ps.sqProcessStatusId == item.rfStatusId select ps.chValue).ToString(); foreach (var item2 in apartList) { booking = new BookingList { rfCategoryId = 2, rfProductId = item2.dgApartId, sqProcessId = item.sqProcessId, chProductName = item2.chFulName, dgTotalPrice = Convert.ToInt32(item.dgPrice), chDeliveryPlace_1 = item2.chAdress, dgDurum = Convert.ToInt32(item.rfStatusId), chDurum = chDurum_, dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14), dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14), dtCreated = Convert.ToDateTime(item.dtCreated) }; bookingList.Add(booking); } } #endregion #region Tour if (item.rfCategoryId == 3) { List<TourList> tourList = set.loadTourList(prodId); string chDurum_ = (from ps in dm.ProcessStatus where 1 == 1 && ps.sqProcessStatusId == item.rfStatusId select ps.chValue).ToString(); foreach (var item2 in tourList) { booking = new BookingList { rfCategoryId = 2, rfProductId = item2.dgTourId, sqProcessId = item.sqProcessId, chProductName = item2.chFulName, dgTotalPrice = Convert.ToInt32(item.dgPrice), chDeliveryPlace_1 = item2.chPlaces, dgDurum = Convert.ToInt32(item.rfStatusId), chDurum = chDurum_, dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14), dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14), dtCreated = Convert.ToDateTime(item.dtCreated) }; bookingList.Add(booking); } } #endregion } return bookingList; //araçlar için yaptığı rezervayon }
public ActionResult Vehicle() { string prod_ = Request.QueryString["prod"]; ErrorLog error = new ErrorLog(); dm = new SeyahatIstanbulEntities(); if (Session["kId"] == null) { error.dgErrorCode = 1; error.chError = "Üye girişi yapılmadan rezarvasyon yapılmaya çalışılıyor"; error.chPageName = "Vehicle/BookingController"; error.dtCreated = DateTime.Now; error.chIpAddress = Request.UserHostAddress; dm.ErrorLog.Add(error); dm.SaveChanges(); return RedirectToAction("Index", "Home"); } else if (prod_ == "") { error.dgErrorCode = 1; error.chError = "Doğru linkle giriş yapılmıyor"; error.chPageName = "Booking/BookingController"; error.dtCreated = DateTime.Now; error.chIpAddress = Request.UserHostAddress; dm.ErrorLog.Add(error); dm.SaveChanges(); return RedirectToAction("Index", "Home"); } int prod; try { prod = Convert.ToInt32(prod_); } catch (Exception) { throw; } SettingController set = new SettingController(); List<VehicleList> vehicleList = set.loadVehicleList().Where(d => d.dgVehicleId == prod).ToList(); ViewBag.Clock = set.ddClock(); ViewBag.TabVehicleList = set.ddVehicleList(); ViewBag.VehicleDeliveryPlace = set.ddVehicleDeliveryPlace(); ViewBag.VehicleList = vehicleList; return View(); }
public ActionResult MyBooking() { //if (Session["kId"] == null) //{ // return RedirectToAction("Index", "Home");; //} //if (Session["kId"] == null) // return RedirectToAction("index", "Home"); SettingController set = new SettingController(); //set.bookingSettings(); ViewBag.BookingList = loadVehicleList(); return View(); }