public ActionResult EditPlace(int PlaceId) { if ((string)Session["userCode"] == "admin") { try { PlaceDetailViewModel sp = new PlaceDetailViewModel(); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; ViewData["pl"] = q; EditPlaceViewModel epvm = new EditPlaceViewModel(); epvm.CountryId = q.CountryId; epvm.CityId = q.CityId; epvm.PlaceName = q.PlaceName; epvm.PlaceAddress = q.PlaceAddress; epvm.PlaceTypeList = new SelectList(entity.PlaceTypes, "PlaceTypeId", "PlaceTypeName"); return(View(epvm)); } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Place", "EditPlace"))); } } else { Session["message"] = "please log In first."; return(RedirectToAction("Welcome", "Home")); } }
public ActionResult EditPlace(EditPlaceViewModel epvm1) { if (ModelState.IsValid) { if ((string)Session["userCode"] == "admin") { try { if (epvm1.PlaceId != 0) { Place place = (from c in entity.Places where c.PlaceId == epvm1.PlaceId select c).FirstOrDefault(); if (epvm1.PlaceTypeId == null) { epvm1.PlaceTypeId = Convert.ToInt32(place.PlaceTypeId); } if (epvm1.PlaceDetail == null) { epvm1.PlaceDetail = place.PlaceDetail; } Place p = (from c in entity.Places where c.PlaceId == epvm1.PlaceId select c).SingleOrDefault(); p.PlaceDetail = epvm1.PlaceDetail; p.PlaceTypeId = epvm1.PlaceTypeId; p.PlaceAddress = epvm1.PlaceAddress; p.PlaceName = epvm1.PlaceName; if (entity.SaveChanges() > 0) { ModelState.Clear(); TempData["EditPlace"] = "done"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } else { TempData["EditPlace"] = "Problem occured"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } } else { TempData["EditPlace"] = "Not chosen any data"; return(RedirectToAction("SearchPlaceDetail", "Place", new { PlaceId = epvm1.PlaceId })); } } catch (Exception ex) { return(View("Error", new HandleErrorInfo(ex, "Admin", "EditPlace"))); } } else { Session["message"] = "please log in First"; return(RedirectToAction("Welcome", "Home")); } } else { PlaceDetailViewModel sp = new PlaceDetailViewModel(); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == epvm1.PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; ViewData["pl"] = q; EditPlaceViewModel epvm = new EditPlaceViewModel(); epvm.CountryId = q.CountryId; epvm.CityId = q.CityId; epvm.PlaceName = q.PlaceName; epvm.PlaceAddress = q.PlaceAddress; epvm.PlaceTypeList = new SelectList(entity.PlaceTypes, "PlaceTypeId", "PlaceTypeName"); return(View(epvm)); } }
public ActionResult SearchPlaceDetail(int PlaceId) { if (TempData["CheckInPlaceSearch"] != null) { TempData["CheckInPlaceSearch"] = TempData["CheckInPlaceSearch"]; } if (TempData["AddToWishPlaceSearch"] != null) { TempData["AddToWishPlaceSearch"] = TempData["AddToWishPlaceSearch"]; } if (TempData["PlaceBlock"] != null) { TempData["PlaceBlock"] = TempData["PlaceBlock"]; } if (TempData["PlaceProPic"] != null) { TempData["PlaceProPic"] = TempData["PlaceProPic"]; } if (TempData["EditPlace"] != null) { TempData["EditPlace"] = TempData["EditPlace"]; } PlaceDetailViewModel sp = new PlaceDetailViewModel(); if (PlaceId != 0) { var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceId == PlaceId orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, c.PlaceDetail, g.CityId, f.CountryId, k.PlaceTypeName, c.PlaceAdminsPermit, }).First(); if (p != null) { sp.PlacePictureData = p.PlacePictureData; sp.PlaceId = p.PlaceId; sp.PlaceName = p.PlaceName; sp.PlaceAddress = p.PlaceAddress; sp.PlaceLike = Convert.ToInt32(p.PlaceFavourite); sp.PlaceTypeName = p.PlaceTypeName; sp.CityName = p.CityName; sp.CountryName = p.CountryName; string st = CutDetail.StripHTML(p.PlaceDetail); sp.PlaceShortDetail = CutDetail.Truncate(st, 40); sp.PlaceFullDetail = p.PlaceDetail; sp.PlaceCityId = p.CityId; sp.PlaceCountryId = p.CountryId; sp.PlaceTypeId = p.PlaceTypeId; sp.PlaceAdminPermit = Convert.ToBoolean(p.PlaceAdminsPermit); } var q = sp; return(View(q)); } else { return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult NewPlaceListAdmin() { List <PlaceDetailViewModel> sp = new List <PlaceDetailViewModel>(); DateTime t = DateTime.Now.AddDays(-2); var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.PlaceDateOfAccountCreation >= t orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, g.CityId, f.CountryId, c.PlaceDetail, k.PlaceTypeName, c.PlaceAdminsPermit, }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { PlaceDetailViewModel oivm = new PlaceDetailViewModel(); oivm.PlacePictureData = i.PlacePictureData; oivm.PlaceId = i.PlaceId; oivm.PlaceName = i.PlaceName; oivm.PlaceAddress = i.PlaceAddress; oivm.PlaceLike = Convert.ToInt32(i.PlaceFavourite); oivm.PlaceTypeName = i.PlaceTypeName; oivm.CityName = i.CityName; oivm.CountryName = i.CountryName; string st = CutDetail.StripHTML(i.PlaceDetail); oivm.PlaceShortDetail = CutDetail.Truncate(st, 40); oivm.PlaceFullDetail = i.PlaceDetail; oivm.PlaceCityId = i.CityId; oivm.PlaceCountryId = i.CountryId; oivm.PlaceTypeId = i.PlaceTypeId; oivm.PlaceAdminPermit = Convert.ToBoolean(i.PlaceAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["Place"] = "No data found"; return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult SearchVendorDetail(int VendorId) { VendorDetailViewModel sp = new VendorDetailViewModel(); if (TempData["CheckInVendorSearch"] != null) { TempData["CheckInVendorSearch"] = TempData["CheckInVendorSearch"]; } if (TempData["AddToWishVendorSearch"] != null) { TempData["AddToWishVendorSearch"] = TempData["AddToWishVendorSearch"]; } if (TempData["BlockMessageSearch"] != null) { TempData["BlockMessageSearch"] = TempData["BlockMessageSearch"]; } if (VendorId != 0) { var o = (from c in entity.Vendors join e in entity.VendorPictures on c.VendorProfilePicId equals e.VendorPictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on c.VendorTypeId equals k.VendorTypeId where c.VendorId == VendorId orderby c.VendorFavourite descending select new { c.VendorId, c.VendorOfficeName, e.VendorPictureData, c.VendorOfficeAddress, c.VendorOfficeWebsite, c.VendorOfficePhnNo, k.VendorTypeId, k.VendorTypeName, c.CountryId, c.CityId, c.VendorFavourite, c.VendorsVendorShipDetail, g.CityName, f.CountryName, c.VendorOfferStatus, c.VendorsStatus, c.VendorAdminsPermit }).First(); if (o != null) { sp.VendorId = o.VendorId; sp.VendorName = o.VendorOfficeName; sp.VendorAddress = o.VendorOfficeAddress; sp.VendorPhnNo = o.VendorOfficePhnNo; sp.VendorWebsite = o.VendorOfficeWebsite; sp.VendorTypeId = Convert.ToInt32(o.VendorTypeId); sp.VendorTypeName = o.VendorTypeName; sp.CityId = Convert.ToInt32(o.CityId); sp.CityName = o.CityName; sp.CountryId = Convert.ToInt32(o.CountryId); sp.CountryName = o.CountryName; sp.VendorPictureData = o.VendorPictureData; sp.VendorStatus = Convert.ToBoolean(o.VendorsStatus); sp.VendorOfferStatus = Convert.ToBoolean(o.VendorOfferStatus); string VendorShortDetail = CutDetail.StripHTML(o.VendorsVendorShipDetail); sp.VendorShortDetail = CutDetail.Truncate(VendorShortDetail, 40); sp.VendorFullDetail = o.VendorsVendorShipDetail; sp.VendorLike = Convert.ToInt32(o.VendorFavourite); sp.VendorAdminPermit = Convert.ToBoolean(o.VendorAdminsPermit); } var q = sp; return(View(q)); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult SearchPlaceListWithType(int CountryId, int CityId, int PlaceTypeId) { Session["SearchPlaceTypeId"] = PlaceTypeId; List <PlaceDetailViewModel> sp = new List <PlaceDetailViewModel>(); Session["SearchPlaceListType"] = "yes"; if (CountryId != 0 && CityId != 0) { var p = (from c in entity.Places join e in entity.PlacePictures on c.PlaceProfilePicId equals e.PlacePictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.PlaceTypes on c.PlaceTypeId equals k.PlaceTypeId where c.CountryId == CountryId && c.CityId == CityId && c.PlaceTypeId == PlaceTypeId && c.PlaceAdminsPermit == true orderby c.PlaceFavourite descending select new { c.PlaceId, c.PlaceName, e.PlacePictureData, k.PlaceTypeId, c.PlaceAddress, c.PlaceFavourite, f.CountryName, g.CityName, g.CityId, f.CountryId, c.PlaceDetail, k.PlaceTypeName, c.PlaceAdminsPermit, }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { PlaceDetailViewModel oivm = new PlaceDetailViewModel(); oivm.PlacePictureData = i.PlacePictureData; oivm.PlaceId = i.PlaceId; oivm.PlaceName = i.PlaceName; oivm.PlaceAddress = i.PlaceAddress; oivm.PlaceLike = Convert.ToInt32(i.PlaceFavourite); oivm.PlaceTypeName = i.PlaceTypeName; oivm.CityName = i.CityName; oivm.CountryName = i.CountryName; string st = CutDetail.StripHTML(i.PlaceDetail); oivm.PlaceShortDetail = CutDetail.Truncate(st, 40); oivm.PlaceFullDetail = i.PlaceDetail; oivm.PlaceCityId = i.CityId; oivm.PlaceCountryId = i.CountryId; oivm.PlaceTypeId = i.PlaceTypeId; oivm.PlaceAdminPermit = Convert.ToBoolean(i.PlaceAdminsPermit); sp.Add(oivm); } var q = sp; TempData["CountryId"] = CountryId; TempData["CityId"] = CityId; return(View(q)); } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } }
public ActionResult MyOfferList() { List <OfferDetailViewModel> sp = new List <OfferDetailViewModel>(); int vendorId = (int)Session["VendorId"]; var p = (from c in entity.Offers join e in entity.OfferPictures on c.OfferProfilePicId equals e.OfferPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Vendors on c.VendorId equals d.VendorId join f in entity.Countries on c.CountryId equals f.CountryId join i in entity.OfferTypes on c.OfferTypeId equals i.OfferTypeId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on d.VendorTypeId equals k.VendorTypeId where c.VendorId == vendorId orderby d.VendorFavourite descending select new { c.OfferId, c.OfferName, e.OfferPictureData, d.VendorId, d.VendorOfficeName, c.OfferTypeId, d.VendorTypeId, i.OfferTypeName, f.CountryId, g.CityId, d.VendorPhnNo, d.VendorOfficeAddress, f.CountryName, g.CityName, c.OfferStartTime, c.OfferStopTime, c.OfferDetail, c.OfferPrice, k.VendorTypeName, c.OfferStatus, c.OfferAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { OfferDetailViewModel oivm = new OfferDetailViewModel(); oivm.OfferId = i.OfferId; oivm.OfferTypeName = i.OfferTypeName; oivm.OfferTypeId = Convert.ToInt32(i.OfferTypeId); oivm.VendorTypeId = Convert.ToInt32(i.VendorTypeId); oivm.CountryId = i.CountryId; oivm.CityId = i.CityId; oivm.OfferName = i.OfferName; oivm.OfferPictureData = i.OfferPictureData; oivm.VendorId = i.VendorId; oivm.VendorName = i.VendorOfficeName; oivm.OfferPhnNo = i.VendorPhnNo; oivm.OfferAddress = i.VendorOfficeAddress; oivm.CountryName = i.CountryName; oivm.CityName = i.CityName; oivm.OfferPrice = i.OfferPrice; string st = CutDetail.StripHTML(i.OfferDetail); oivm.OfferShortDetail = CutDetail.Truncate(st, 40); oivm.OfferFullDetail = i.OfferDetail; oivm.OfferingStartTime = Convert.ToDateTime(i.OfferStartTime); oivm.OfferingEndTime = Convert.ToDateTime(i.OfferStopTime); oivm.VendorTypeName = i.VendorTypeName; oivm.OfferStatus = Convert.ToBoolean(i.OfferStatus); oivm.OfferAdminPermit = Convert.ToBoolean(i.OfferAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["hostAvai"] = "no"; return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult SearchVendorList(int VendorTypeId, int CountryId, int CityId) { List <VendorDetailViewModel> sp = new List <VendorDetailViewModel>(); Session["SearchVendorList"] = "yes"; Session["VendorTypeId"] = VendorTypeId; var p = (from c in entity.Vendors join e in entity.VendorPictures on c.VendorProfilePicId equals e.VendorPictureId into ppl from e in ppl.DefaultIfEmpty() join f in entity.Countries on c.CountryId equals f.CountryId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on c.VendorTypeId equals k.VendorTypeId where c.VendorTypeId == VendorTypeId && c.VendorsStatus == true && c.VendorAdminsPermit == true && c.CountryId == CountryId && c.CityId == CityId orderby c.VendorFavourite descending select new { c.VendorId, c.VendorOfficeName, e.VendorPictureData, c.VendorOfficeAddress, c.VendorOfficeWebsite, c.VendorOfficePhnNo, k.VendorTypeId, k.VendorTypeName, c.CountryId, c.CityId, c.VendorFavourite, c.VendorsVendorShipDetail, g.CityName, f.CountryName, c.VendorOfferStatus, c.VendorsStatus, c.VendorAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var o in p) { VendorDetailViewModel oivm = new VendorDetailViewModel(); oivm.VendorId = o.VendorId; oivm.VendorName = o.VendorOfficeName; oivm.VendorAddress = o.VendorOfficeAddress; oivm.VendorPhnNo = o.VendorOfficePhnNo; oivm.VendorWebsite = o.VendorOfficeWebsite; oivm.VendorTypeId = Convert.ToInt32(o.VendorTypeId); oivm.VendorTypeName = o.VendorTypeName; oivm.CityId = Convert.ToInt32(o.CityId); oivm.CityName = o.CityName; oivm.CountryId = Convert.ToInt32(o.CountryId); oivm.CountryName = o.CountryName; oivm.VendorPictureData = o.VendorPictureData; oivm.VendorStatus = Convert.ToBoolean(o.VendorsStatus); oivm.VendorOfferStatus = Convert.ToBoolean(o.VendorOfferStatus); string VendorShortDetail = CutDetail.StripHTML(o.VendorsVendorShipDetail); oivm.VendorShortDetail = CutDetail.Truncate(VendorShortDetail, 40); oivm.VendorFullDetail = o.VendorsVendorShipDetail; oivm.VendorLike = Convert.ToInt32(o.VendorFavourite); oivm.VendorAdminPermit = Convert.ToBoolean(o.VendorAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["Vendor"] = "No data found"; return(RedirectToAction("Index", "Home")); } }
public ActionResult SearchOfferOfferDetail(int OfferId) { OfferDetailViewModel sp = new OfferDetailViewModel(); if (OfferId != 0) { var i = (from c in entity.Offers join e in entity.OfferPictures on c.OfferProfilePicId equals e.OfferPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Vendors on c.VendorId equals d.VendorId join f in entity.Countries on c.CountryId equals f.CountryId join j in entity.OfferTypes on c.OfferTypeId equals j.OfferTypeId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on d.VendorTypeId equals k.VendorTypeId where c.OfferId == OfferId orderby d.VendorFavourite descending select new { c.OfferId, c.OfferName, e.OfferPictureData, d.VendorId, d.VendorOfficeName, c.OfferTypeId, d.VendorTypeId, j.OfferTypeName, f.CountryId, g.CityId, d.VendorPhnNo, d.VendorOfficeAddress, f.CountryName, g.CityName, c.OfferStartTime, c.OfferStopTime, c.OfferDetail, c.OfferPrice, k.VendorTypeName, c.OfferStatus, c.OfferAdminsPermit }).First(); if (i != null) { sp.OfferId = i.OfferId; sp.OfferTypeName = i.OfferTypeName; sp.OfferTypeId = Convert.ToInt32(i.OfferTypeId); sp.VendorTypeId = Convert.ToInt32(i.VendorTypeId); sp.CountryId = i.CountryId; sp.CityId = i.CityId; sp.OfferName = i.OfferName; sp.OfferPictureData = i.OfferPictureData; sp.VendorId = i.VendorId; sp.VendorName = i.VendorOfficeName; sp.OfferPhnNo = i.VendorPhnNo; sp.OfferAddress = i.VendorOfficeAddress; sp.CountryName = i.CountryName; sp.CityName = i.CityName; sp.OfferPrice = i.OfferPrice; string st = CutDetail.StripHTML(i.OfferDetail); sp.OfferShortDetail = CutDetail.Truncate(st, 40); sp.OfferFullDetail = i.OfferDetail; sp.OfferingStartTime = Convert.ToDateTime(i.OfferStartTime); sp.OfferingEndTime = Convert.ToDateTime(i.OfferStopTime); sp.VendorTypeName = i.VendorTypeName; sp.OfferStatus = Convert.ToBoolean(i.OfferStatus); sp.OfferAdminPermit = Convert.ToBoolean(i.OfferAdminsPermit); } var q = sp; return(View(q)); } else { Session["message"] = "No data found"; return(RedirectToAction("Index", "Home")); } }
public ActionResult SearchOfferList(int CountryId, int CityId, int VendorTypeId, string Arrival, string Departure) { List <OfferDetailViewModel> sp = new List <OfferDetailViewModel>(); DateTime t = DateTime.Now; if ((CountryId != 0 && CityId != 0) && ((Arrival == "" && Departure == "") || (Arrival == null || Departure == null))) { Session["SearchCountryId"] = CountryId; Session["SearchCityId"] = CityId; Session["SearchArrival"] = ""; Session["SearchDeparture"] = ""; Session["VendorTypeId"] = VendorTypeId; var p = (from c in entity.Offers join e in entity.OfferPictures on c.OfferProfilePicId equals e.OfferPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Vendors on c.VendorId equals d.VendorId join f in entity.Countries on c.CountryId equals f.CountryId join i in entity.OfferTypes on c.OfferTypeId equals i.OfferTypeId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on d.VendorTypeId equals k.VendorTypeId where c.CountryId == CountryId && c.CityId == CityId && c.OfferStatus == true && c.OfferAdminsPermit == true && c.OfferStopTime >= t orderby d.VendorFavourite descending select new { c.OfferId, c.OfferName, e.OfferPictureData, d.VendorId, d.VendorOfficeName, c.OfferTypeId, d.VendorTypeId, i.OfferTypeName, f.CountryId, g.CityId, d.VendorPhnNo, d.VendorOfficeAddress, f.CountryName, g.CityName, c.OfferStartTime, c.OfferStopTime, c.OfferDetail, c.OfferPrice, k.VendorTypeName, c.OfferStatus, c.OfferAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { OfferDetailViewModel oivm = new OfferDetailViewModel(); oivm.OfferId = i.OfferId; oivm.OfferTypeName = i.OfferTypeName; oivm.OfferTypeId = Convert.ToInt32(i.OfferTypeId); oivm.VendorTypeId = Convert.ToInt32(i.VendorTypeId); oivm.CountryId = i.CountryId; oivm.CityId = i.CityId; oivm.OfferName = i.OfferName; oivm.OfferPictureData = i.OfferPictureData; oivm.VendorId = i.VendorId; oivm.VendorName = i.VendorOfficeName; oivm.OfferPhnNo = i.VendorPhnNo; oivm.OfferAddress = i.VendorOfficeAddress; oivm.CountryName = i.CountryName; oivm.CityName = i.CityName; oivm.OfferPrice = i.OfferPrice; string st = CutDetail.StripHTML(i.OfferDetail); oivm.OfferShortDetail = CutDetail.Truncate(st, 40); oivm.OfferFullDetail = i.OfferDetail; oivm.OfferingStartTime = Convert.ToDateTime(i.OfferStartTime); oivm.OfferingEndTime = Convert.ToDateTime(i.OfferStopTime); oivm.VendorTypeName = i.VendorTypeName; oivm.OfferStatus = Convert.ToBoolean(i.OfferStatus); oivm.OfferAdminPermit = Convert.ToBoolean(i.OfferAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { Arrival = Convert.ToString(Arrival); Departure = Convert.ToString(Departure); TempData["offerAvai"] = "no"; return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } } else if ((CountryId != 0 && CityId != 0) && ((Arrival != "" && Departure != "") || (Arrival != null || Departure != null))) { Session["SearchCountryId"] = CountryId; Session["SearchCityId"] = CityId; Session["SearchArrival"] = Arrival; Session["SearchDeparture"] = Departure; DateTime a = Convert.ToDateTime(Arrival); Session["VendorTypeId"] = VendorTypeId; DateTime de = Convert.ToDateTime(Departure); var p = (from c in entity.Offers join e in entity.OfferPictures on c.OfferProfilePicId equals e.OfferPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Vendors on c.VendorId equals d.VendorId join f in entity.Countries on c.CountryId equals f.CountryId join i in entity.OfferTypes on c.OfferTypeId equals i.OfferTypeId join g in entity.Cities on c.CityId equals g.CityId join k in entity.VendorTypes on d.VendorTypeId equals k.VendorTypeId where c.CountryId == CountryId && c.CityId == CityId && c.OfferStartTime >= a && c.OfferStopTime >= de && c.OfferStatus == true && c.OfferAdminsPermit == true && c.OfferStopTime >= t orderby d.VendorFavourite descending select new { c.OfferId, c.OfferName, e.OfferPictureData, d.VendorId, d.VendorOfficeName, c.OfferTypeId, d.VendorTypeId, i.OfferTypeName, f.CountryId, g.CityId, d.VendorPhnNo, d.VendorOfficeAddress, f.CountryName, g.CityName, c.OfferStartTime, c.OfferStopTime, c.OfferDetail, c.OfferPrice, k.VendorTypeName, c.OfferStatus, c.OfferAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { OfferDetailViewModel oivm = new OfferDetailViewModel(); oivm.OfferId = i.OfferId; oivm.OfferTypeName = i.OfferTypeName; oivm.OfferTypeId = Convert.ToInt32(i.OfferTypeId); oivm.VendorTypeId = Convert.ToInt32(i.VendorTypeId); oivm.CountryId = i.CountryId; oivm.CityId = i.CityId; oivm.OfferName = i.OfferName; oivm.OfferPictureData = i.OfferPictureData; oivm.VendorId = i.VendorId; oivm.VendorName = i.VendorOfficeName; oivm.OfferPhnNo = i.VendorPhnNo; oivm.OfferAddress = i.VendorOfficeAddress; oivm.CountryName = i.CountryName; oivm.CityName = i.CityName; oivm.OfferPrice = i.OfferPrice; string st = CutDetail.StripHTML(i.OfferDetail); oivm.OfferShortDetail = CutDetail.Truncate(st, 40); oivm.OfferFullDetail = i.OfferDetail; oivm.OfferingStartTime = Convert.ToDateTime(i.OfferStartTime); oivm.OfferingEndTime = Convert.ToDateTime(i.OfferStopTime); oivm.VendorTypeName = i.VendorTypeName; oivm.OfferStatus = Convert.ToBoolean(i.OfferStatus); oivm.OfferAdminPermit = Convert.ToBoolean(i.OfferAdminsPermit); sp.Add(oivm); } var q = sp; return(View(q)); } else { Arrival = Convert.ToString(Arrival); Departure = Convert.ToString(Departure); TempData["offerAvai"] = "no"; return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = Arrival, Departure = Departure })); } } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = Arrival, Departure = Departure })); } }
public ActionResult MyHostList() { List <HostDetailSearchViewModel> sp = new List <HostDetailSearchViewModel>(); int touristId = (int)Session["TouristId"]; var p = (from c in entity.Hosts join e in entity.HostPictures on c.HostProfilePicId equals e.HostPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Tourists on c.TouristId equals d.TouristId join f in entity.Countries on c.HostingCountryId equals f.CountryId join g in entity.Cities on c.HostingCityId equals g.CityId join k in entity.HostTypes on c.HostTypeId equals k.HostTypeId where c.TouristId == touristId orderby c.HostDateOfAccountCreation descending select new { c.HostId, d.TouristName, e.HostPictureData, d.TouristId, f.CountryId, g.CityId, k.HostTypeId, c.HostingPhnNo, c.HostingPlaceAddress, f.CountryName, g.CityName, c.HostingStartTime, c.HostingStopTime, c.HostingDetail, c.Rent, k.HostTypeName, c.HostingStatus, c.HostAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { HostDetailSearchViewModel oivm = new HostDetailSearchViewModel(); oivm.HostPictureData = i.HostPictureData; oivm.HostId = i.HostId; oivm.TouristId = Convert.ToInt32(i.TouristId); oivm.HostName = i.TouristName; oivm.HostAddress = i.HostingPlaceAddress; oivm.HostTypeName = i.HostTypeName; oivm.HostPhnNo = i.HostingPhnNo; oivm.CityId = i.CityId; oivm.CountryId = i.CountryId; oivm.HostTypeId = i.HostTypeId; oivm.HostPrice = i.Rent; oivm.HostingStartTime = Convert.ToDateTime(i.HostingStartTime); oivm.HostingEndTime = Convert.ToDateTime(i.HostingStopTime); string st = CutDetail.StripHTML(i.HostingDetail); oivm.HostShortDetail = CutDetail.Truncate(st, 40); oivm.HostFullDetail = i.HostingDetail; oivm.HostTypeName = i.HostTypeName; oivm.hostAdminPermit = Convert.ToBoolean(i.HostAdminsPermit); oivm.HostStatus = Convert.ToBoolean(i.HostingStatus); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["hostAvai"] = "no"; return(RedirectToAction("UserPanel", "Home")); } }
public ActionResult ShowHost(int HostId, int CountryId, int CityId, int Page) { HostDetailSearchViewModel sp = new HostDetailSearchViewModel(); if (HostId != 0) { var i = (from c in entity.Hosts join e in entity.HostPictures on c.HostProfilePicId equals e.HostPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Tourists on c.TouristId equals d.TouristId join f in entity.Countries on c.HostingCountryId equals f.CountryId join g in entity.Cities on c.HostingCityId equals g.CityId join k in entity.HostTypes on c.HostTypeId equals k.HostTypeId where c.HostId == HostId orderby c.HostDateOfAccountCreation descending select new { c.HostId, d.TouristName, e.HostPictureData, d.TouristId, f.CountryId, g.CityId, k.HostTypeId, c.HostingPhnNo, c.HostingPlaceAddress, f.CountryName, g.CityName, c.HostingStartTime, c.HostingStopTime, c.HostingDetail, c.Rent, k.HostTypeName, c.HostingStatus, c.HostAdminsPermit }).First(); if (i != null) { sp.HostPictureData = i.HostPictureData; sp.HostId = i.HostId; sp.TouristId = Convert.ToInt32(i.TouristId); sp.HostName = i.TouristName; sp.HostAddress = i.HostingPlaceAddress; sp.HostTypeName = i.HostTypeName; sp.HostPhnNo = i.HostingPhnNo; sp.CityId = i.CityId; sp.CountryId = i.CountryId; sp.HostTypeId = i.HostTypeId; sp.HostPrice = i.Rent; sp.HostingStartTime = Convert.ToDateTime(i.HostingStartTime); sp.HostingEndTime = Convert.ToDateTime(i.HostingStopTime); string st = CutDetail.StripHTML(i.HostingDetail); sp.HostShortDetail = CutDetail.Truncate(st, 40); sp.HostFullDetail = i.HostingDetail; sp.HostTypeName = i.HostTypeName; sp.hostAdminPermit = Convert.ToBoolean(i.HostAdminsPermit); sp.HostStatus = Convert.ToBoolean(i.HostingStatus); } var q = sp; TempData["CountryId"] = CountryId; TempData["CityId"] = CityId; return(View(q)); } else { return(RedirectToAction("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = "", Departure = "" })); } }
public ActionResult SearchHostList(int CountryId, int CityId, string Arrival, string Departure) { List <HostDetailSearchViewModel> sp = new List <HostDetailSearchViewModel>(); DateTime t = DateTime.Now; if ((CountryId != 0 && CityId != 0) && ((Arrival == "" && Departure == "") || (Arrival == null || Departure == null))) { Session["HostList"] = "yes"; var p = (from c in entity.Hosts join e in entity.HostPictures on c.HostProfilePicId equals e.HostPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Tourists on c.TouristId equals d.TouristId join f in entity.Countries on c.HostingCountryId equals f.CountryId join g in entity.Cities on c.HostingCityId equals g.CityId join k in entity.HostTypes on c.HostTypeId equals k.HostTypeId where c.HostingCountryId == CountryId && c.HostingCityId == CityId && c.HostingStatus == true && c.HostAdminsPermit == true && c.HostingStopTime >= t orderby c.HostDateOfAccountCreation descending select new { c.HostId, d.TouristName, e.HostPictureData, d.TouristId, f.CountryId, g.CityId, k.HostTypeId, c.HostingPhnNo, c.HostingPlaceAddress, f.CountryName, g.CityName, c.HostingStartTime, c.HostingStopTime, c.HostingDetail, c.Rent, k.HostTypeName, c.HostingStatus, c.HostAdminsPermit }).ToList(); int x = p.Count(); if (x > 0) { foreach (var i in p) { HostDetailSearchViewModel oivm = new HostDetailSearchViewModel(); oivm.HostPictureData = i.HostPictureData; oivm.HostId = i.HostId; oivm.TouristId = Convert.ToInt32(i.TouristId); oivm.HostName = i.TouristName; oivm.HostAddress = i.HostingPlaceAddress; oivm.HostTypeName = i.HostTypeName; oivm.HostPhnNo = i.HostingPhnNo; oivm.CityId = i.CityId; oivm.CountryId = i.CountryId; oivm.HostTypeId = i.HostTypeId; oivm.HostPrice = i.Rent; oivm.HostingStartTime = Convert.ToDateTime(i.HostingStartTime); oivm.HostingEndTime = Convert.ToDateTime(i.HostingStopTime); string st = CutDetail.StripHTML(i.HostingDetail); oivm.HostShortDetail = CutDetail.Truncate(st, 40); oivm.HostFullDetail = i.HostingDetail; oivm.HostTypeName = i.HostTypeName; oivm.hostAdminPermit = Convert.ToBoolean(i.HostAdminsPermit); oivm.HostStatus = Convert.ToBoolean(i.HostingStatus); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["hostAvai"] = "no"; return(Redirect(Url.Action("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = Arrival, Departure = Departure }) + "#successMessage")); } } else if ((CountryId != 0 && CityId != 0) && ((Arrival != "" && Departure != "") && (Arrival != null || Departure != null))) { DateTime a = Convert.ToDateTime(Arrival); DateTime de = Convert.ToDateTime(Departure); Session["HostList"] = "yes"; var l = (from c in entity.Hosts join e in entity.HostPictures on c.HostProfilePicId equals e.HostPictureId into ppl from e in ppl.DefaultIfEmpty() join d in entity.Tourists on c.TouristId equals d.TouristId join f in entity.Countries on c.HostingCountryId equals f.CountryId join g in entity.Cities on c.HostingCityId equals g.CityId join k in entity.HostTypes on c.HostTypeId equals k.HostTypeId where c.HostingCountryId == CountryId && c.HostingCityId == CityId && c.HostingStartTime >= a && c.HostingStopTime >= de && c.HostingStatus == true && c.HostAdminsPermit == true && c.HostingStopTime >= t orderby c.HostDateOfAccountCreation descending select new { c.HostId, d.TouristName, e.HostPictureData, d.TouristId, f.CountryId, g.CityId, k.HostTypeId, c.HostingPhnNo, c.HostingPlaceAddress, f.CountryName, g.CityName, c.HostingStartTime, c.HostingStopTime, c.HostingDetail, c.Rent, k.HostTypeName, c.HostingStatus, c.HostAdminsPermit }).ToList(); int y = l.Count(); if (y > 0) { foreach (var i in l) { HostDetailSearchViewModel oivm = new HostDetailSearchViewModel(); oivm.HostPictureData = i.HostPictureData; oivm.HostId = i.HostId; oivm.TouristId = Convert.ToInt32(i.TouristId); oivm.HostName = i.TouristName; oivm.HostAddress = i.HostingPlaceAddress; oivm.HostTypeName = i.HostTypeName; oivm.HostPhnNo = i.HostingPhnNo; oivm.CityId = i.CityId; oivm.CountryId = i.CountryId; oivm.HostTypeId = i.HostTypeId; oivm.HostPrice = i.Rent; oivm.HostingStartTime = Convert.ToDateTime(i.HostingStartTime); oivm.HostingEndTime = Convert.ToDateTime(i.HostingStopTime); string st = CutDetail.StripHTML(i.HostingDetail); oivm.HostShortDetail = CutDetail.Truncate(st, 40); oivm.HostFullDetail = i.HostingDetail; oivm.HostTypeName = i.HostTypeName; oivm.hostAdminPermit = Convert.ToBoolean(i.HostAdminsPermit); oivm.HostStatus = Convert.ToBoolean(i.HostingStatus); sp.Add(oivm); } var q = sp; return(View(q)); } else { TempData["hostAvai"] = "no"; return(Redirect(Url.Action("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = Arrival, Departure = Departure }) + "#successMessage")); } } else { TempData["hostAvai"] = "no"; return(Redirect(Url.Action("Search", "Home", new { CountryId = CountryId, CityId = CityId, Arrival = Arrival, Departure = Departure }) + "#successMessage")); } }