public OfferDetailPage(Offer offer)
        {
            InitializeComponent();
            var offerViewModel = new OfferDetailViewModel(Navigation);

            offerViewModel.Offer = offer;
            BindingContext       = offerViewModel;
        }
Beispiel #2
0
        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"));
            }
        }
Beispiel #3
0
        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"));
            }
        }
Beispiel #4
0
        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 }));
            }
        }