Esempio n. 1
0
        private void SetupBooking()
        {
            try { SelectedBooking = Core.Entities.Booking.Find(Id: Convert.ToInt32(Request.QueryString["id"])); }
            catch { SelectedBooking = null; }

            if (SelectedBooking == null || (SelectedBooking.UserId != Master.CurrentUser.Id && SelectedBooking.Listing.UserId != Master.CurrentUser.Id))
            {
                Master.Feedback = "Booking not found";
                Response.Redirect("/account/seeking");
            }

            Master.SelectedUrl = SelectedBooking.UserId == Master.CurrentUser.Id ? "/account/seeking" : "/account/offering";

            ShowDetails();
        }
Esempio n. 2
0
        private void SetupRequest()
        {
            Master.SelectedUrl = "/account/seeking";

            var listingId   = Convert.ToInt32(Request.QueryString["lid"]);
            var categoryId  = Convert.ToInt32(Request.QueryString["cid"]);
            var serviceId   = Convert.ToInt32(Request.QueryString["sid"]);
            var latitude    = Convert.ToDecimal(Request.QueryString["lat"]);
            var longitude   = Convert.ToDecimal(Request.QueryString["lng"]);
            var startDate   = Convert.ToDateTime(Request.QueryString["std"]);
            var size        = Convert.ToInt32(Request.QueryString["qty"]);
            var includeFuel = Request.QueryString["fue"] == "1";
            var mobile      = true;

            if (categoryId == Core.Entities.Category.ProcessingId)
            {
                mobile = Request.QueryString["mob"] == "1";
            }
            var bookingFor           = (Core.Entities.BookingFor)Enum.ToObject(typeof(Core.Entities.BookingFor), Convert.ToInt32(Request.QueryString["for"]));
            var destinationLatitude  = Convert.ToDecimal(Request.QueryString["dla"]);
            var destinationLongitude = Convert.ToDecimal(Request.QueryString["dlo"]);
            var totalVolume          = Convert.ToDecimal(Request.QueryString["vol"]);
            var additionalInfo       = Request.QueryString["des"];

            var results = Core.Entities.ListingSearchResult.List(0, 10, "Distance", categoryId, serviceId, latitude, longitude, startDate, size, includeFuel, mobile, bookingFor, destinationLatitude, destinationLongitude, totalVolume, listingId);

            if (results.Count != 1)
            {
                Master.Feedback = "Listing not found";
                Response.Redirect("/account/seeking");
            }
            var result = results.First();

            SelectedBooking = new Core.Entities.Booking
            {
                AdditionalInformation = additionalInfo,
                BookingUsers          = null,
                DateCreated           = DateTime.Now,
                Deleted              = false,
                Destination          = string.Empty,
                DestinationLatitude  = destinationLongitude,
                DestinationLongitude = destinationLatitude,
                Distance             = (decimal)result.Distance,
                EndDate              = result.EndDate,
                ForId             = bookingFor,
                FuelCost          = (decimal)result.FuelCost,
                HireCost          = (decimal)result.HireCost,
                Id                = 0,
                IncludeFuel       = includeFuel,
                LastModified      = DateTime.Now,
                Latitude          = latitude,
                Listing           = Core.Entities.Listing.Find(Id: result.ListingId),
                ListingId         = result.ListingId,
                Location          = string.Empty,
                Longitude         = longitude,
                Price             = (decimal)result.Price,
                Quantity          = size,
                Service           = Core.Entities.Service.Find(Id: result.ServiceId),
                ServiceId         = result.ServiceId,
                StartDate         = result.StartDate,
                StatusId          = Core.Entities.BookingStatus.None,
                Transactions      = null,
                TotalVolume       = totalVolume,
                TransportCost     = (decimal)result.TransportCost,
                TransportDistance = (decimal)result.TransportDistance,
                User              = Master.CurrentUser,
                UserId            = Master.CurrentUser.Id
            };

            ShowDetails(result.Available);
        }