Beispiel #1
0
        /// <summary>
        /// Install the plugin
        /// </summary>
        /// <returns>A task that represents the asynchronous operation</returns>
        public override async Task InstallAsync()
        {
            //sample pickup point
            var country = await _countryService.GetCountryByThreeLetterIsoCodeAsync("USA");

            var state = await _stateProvinceService.GetStateProvinceByAbbreviationAsync("NY", country?.Id);

            var address = new Address
            {
                Address1        = "21 West 52nd Street",
                City            = "New York",
                CountryId       = country?.Id,
                StateProvinceId = state?.Id,
                ZipPostalCode   = "10021",
                CreatedOnUtc    = DateTime.UtcNow
            };
            await _addressService.InsertAddressAsync(address);

            var pickupPoint = new StorePickupPoint
            {
                Name         = "New York store",
                AddressId    = address.Id,
                OpeningHours = "10.00 - 19.00",
                PickupFee    = 1.99m
            };
            await _storePickupPointService.InsertStorePickupPointAsync(pickupPoint);

            //locales
            await _localizationService.AddOrUpdateLocaleResourceAsync(new Dictionary <string, string>
            {
                ["Plugins.Pickup.PickupInStore.AddNew"]                                      = "Add a new pickup point",
                ["Plugins.Pickup.PickupInStore.Fields.Description"]                          = "Description",
                ["Plugins.Pickup.PickupInStore.Fields.Description.Hint"]                     = "Specify a description of the pickup point.",
                ["Plugins.Pickup.PickupInStore.Fields.DisplayOrder"]                         = "Display order",
                ["Plugins.Pickup.PickupInStore.Fields.DisplayOrder.Hint"]                    = "Specify the pickup point display order.",
                ["Plugins.Pickup.PickupInStore.Fields.Latitude"]                             = "Latitude",
                ["Plugins.Pickup.PickupInStore.Fields.Latitude.Hint"]                        = "Specify a latitude (DD.dddddddd°).",
                ["Plugins.Pickup.PickupInStore.Fields.Latitude.InvalidPrecision"]            = "Precision should be less then 8",
                ["Plugins.Pickup.PickupInStore.Fields.Latitude.InvalidRange"]                = "Latitude should be in range -90 to 90",
                ["Plugins.Pickup.PickupInStore.Fields.Latitude.IsNullWhenLongitudeHasValue"] = "Latitude and Longitude should be specify together",
                ["Plugins.Pickup.PickupInStore.Fields.Longitude"]                            = "Longitude",
                ["Plugins.Pickup.PickupInStore.Fields.Longitude.Hint"]                       = "Specify a longitude (DD.dddddddd°).",
                ["Plugins.Pickup.PickupInStore.Fields.Longitude.InvalidPrecision"]           = "Precision should be less then 8",
                ["Plugins.Pickup.PickupInStore.Fields.Longitude.InvalidRange"]               = "Longitude should be in range -180 to 180",
                ["Plugins.Pickup.PickupInStore.Fields.Longitude.IsNullWhenLatitudeHasValue"] = "Latitude and Longitude should be specify together",
                ["Plugins.Pickup.PickupInStore.Fields.Name"]                                 = "Name",
                ["Plugins.Pickup.PickupInStore.Fields.Name.Hint"]                            = "Specify a name of the pickup point.",
                ["Plugins.Pickup.PickupInStore.Fields.OpeningHours"]                         = "Opening hours",
                ["Plugins.Pickup.PickupInStore.Fields.OpeningHours.Hint"]                    = "Specify opening hours of the pickup point (Monday - Friday: 09:00 - 19:00 for example).",
                ["Plugins.Pickup.PickupInStore.Fields.PickupFee"]                            = "Pickup fee",
                ["Plugins.Pickup.PickupInStore.Fields.PickupFee.Hint"]                       = "Specify a fee for the shipping to the pickup point.",
                ["Plugins.Pickup.PickupInStore.Fields.Store"]                                = "Store",
                ["Plugins.Pickup.PickupInStore.Fields.Store.Hint"]                           = "A store name for which this pickup point will be available.",
                ["Plugins.Pickup.PickupInStore.Fields.TransitDays"]                          = "Transit days",
                ["Plugins.Pickup.PickupInStore.Fields.TransitDays.Hint"]                     = "The number of days of delivery of the goods to pickup point.",
                ["Plugins.Pickup.PickupInStore.NoPickupPoints"]                              = "No pickup points are available"
            });

            await base.InstallAsync();
        }
        /// <summary>
        /// Install the plugin
        /// </summary>
        public override void Install()
        {
            //database objects
            _objectContext.Install();

            //sample pickup point
            var country = _countryService.GetCountryByThreeLetterIsoCode("USA");
            var state   = _stateProvinceService.GetStateProvinceByAbbreviation("NY", country?.Id);

            var address = new Address
            {
                Address1        = "21 West 52nd Street",
                City            = "New York",
                CountryId       = country?.Id,
                StateProvinceId = state?.Id,
                ZipPostalCode   = "10021",
                CreatedOnUtc    = DateTime.UtcNow
            };

            _addressService.InsertAddress(address);

            var pickupPoint = new StorePickupPoint
            {
                Name         = "New York store",
                AddressId    = address.Id,
                OpeningHours = "10.00 - 19.00",
                PickupFee    = 1.99m
            };

            _storePickupPointService.InsertStorePickupPoint(pickupPoint);

            //locales
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.AddNew", "Add a new pickup point");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Description", "Description");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Description.Hint", "Specify a description of the pickup point.");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.DisplayOrder", "Display order");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.DisplayOrder.Hint", "Specify the pickup point display order.");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Latitude", "Latitude");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Latitude.Hint", "Specify a latitude (DD.dddddddd°).");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Latitude.InvalidPrecision", "Precision should be less then 8");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Latitude.InvalidRange", "Latitude should be in range -90 to 90");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Latitude.IsNullWhenLongitudeHasValue", "Latitude and Longitude should be specify together");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Longitude", "Longitude");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Longitude.Hint", "Specify a longitude (DD.dddddddd°).");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Longitude.InvalidPrecision", "Precision should be less then 8");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Longitude.InvalidRange", "Longitude should be in range -180 to 180");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Longitude.IsNullWhenLatitudeHasValue", "Latitude and Longitude should be specify together");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Name", "Name");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Name.Hint", "Specify a name of the pickup point.");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.OpeningHours", "Opening hours");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.OpeningHours.Hint", "Specify opening hours of the pickup point (Monday - Friday: 09:00 - 19:00 for example).");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.PickupFee", "Pickup fee");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.PickupFee.Hint", "Specify a fee for the shipping to the pickup point.");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Store", "Store");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Store.Hint", "A store name for which this pickup point will be available.");
            _localizationService.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.NoPickupPoints", "No pickup points are available");

            base.Install();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            StorePickupPoint storePickupPoint = db.StorePickupPoints.Find(id);

            db.StorePickupPoints.Remove(storePickupPoint);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id }));
        }
Beispiel #4
0
        /// <summary>
        /// Deletes a pickup point
        /// </summary>
        /// <param name="pickupPoint">Pickup point</param>
        public virtual void DeleteStorePickupPoint(StorePickupPoint pickupPoint)
        {
            if (pickupPoint == null)
            {
                throw new ArgumentNullException("pickupPoint");
            }

            _storePickupPointRepository.Delete(pickupPoint);
        }
Beispiel #5
0
        /// <summary>
        /// Inserts a pickup point
        /// </summary>
        /// <param name="pickupPoint">Pickup point</param>
        public virtual void InsertStorePickupPoint(StorePickupPoint pickupPoint)
        {
            if (pickupPoint == null)
            {
                throw new ArgumentNullException(nameof(pickupPoint));
            }

            _storePickupPointRepository.Insert(pickupPoint);
            _cacheManager.RemoveByPrefix(PICKUP_POINT_PATTERN_KEY);
        }
        /// <summary>
        /// Deletes a pickup point
        /// </summary>
        /// <param name="pickupPoint">Pickup point</param>
        public virtual void DeleteStorePickupPoint(StorePickupPoint pickupPoint)
        {
            if (pickupPoint == null)
            {
                throw new ArgumentNullException("pickupPoint");
            }

            _storePickupPointRepository.Delete(pickupPoint);
            _cacheManager.RemoveByPattern(PICKUP_POINT_PATTERN_KEY);
        }
 public ActionResult Edit([Bind(Include = "Id,StoreDetailId,Address,Remarks,StorePickupStatusId")] StorePickupPoint storePickupPoint)
 {
     if (ModelState.IsValid)
     {
         db.Entry(storePickupPoint).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", new { id = storePickupPoint.StoreDetailId }));
     }
     ViewBag.StoreId             = storePickupPoint.StoreDetailId;
     ViewBag.StoreDetailId       = new SelectList(db.StoreDetails, "Id", "LoginId", storePickupPoint.StoreDetailId);
     ViewBag.StorePickupStatusId = new SelectList(db.StorePickupStatus, "Id", "Name", storePickupPoint.StorePickupStatusId);
     return(View(storePickupPoint));
 }
        // GET: Store/StorePickupPoints/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StorePickupPoint storePickupPoint = db.StorePickupPoints.Find(id);

            if (storePickupPoint == null)
            {
                return(HttpNotFound());
            }
            return(View(storePickupPoint));
        }
        // GET: Store/StorePickupPoints/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StorePickupPoint storePickupPoint = db.StorePickupPoints.Find(id);

            if (storePickupPoint == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StoreId             = storePickupPoint.StoreDetailId;
            ViewBag.StoreDetailId       = new SelectList(db.StoreDetails, "Id", "LoginId", storePickupPoint.StoreDetailId);
            ViewBag.StorePickupStatusId = new SelectList(db.StorePickupStatus, "Id", "Name", storePickupPoint.StorePickupStatusId);
            return(View(storePickupPoint));
        }
Beispiel #10
0
        /// <summary>
        /// Install the plugin
        /// </summary>
        public override void Install()
        {
            //database objects
            _objectContext.Install();

            //sample pickup point
            var country = _countryService.GetCountryByThreeLetterIsoCode("USA");
            var state   = _stateProvinceService.GetStateProvinceByAbbreviation("NY");
            var address = new Address
            {
                Address1        = "21 West 52nd Street",
                City            = "New York",
                CountryId       = country != null ? (int?)country.Id : null,
                StateProvinceId = state != null ? (int?)state.Id : null,
                ZipPostalCode   = "10021",
                CreatedOnUtc    = DateTime.UtcNow
            };

            _addressService.InsertAddress(address);

            var pickupPoint = new StorePickupPoint
            {
                Name         = "New York store",
                AddressId    = address.Id,
                OpeningHours = "10.00 - 19.00",
                PickupFee    = 1.99m
            };

            _storePickupPointService.InsertStorePickupPoint(pickupPoint);

            //locales
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.AddNew", "Add a new pickup point");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Description", "Description");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Description.Hint", "Specify a description of the pickup point.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Name", "Name");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Name.Hint", "Specify a name of the pickup point.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.OpeningHours", "Opening hours");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.OpeningHours.Hint", "Specify an openning hours of the pickup point (Monday - Friday: 09:00 - 19:00 for example).");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.PickupFee", "Pickup fee");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.PickupFee.Hint", "Specify a fee for the shipping to the pickup point.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Store", "Store");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.Fields.Store.Hint", "A store name for which this pickup point will be available.");
            this.AddOrUpdatePluginLocaleResource("Plugins.Pickup.PickupInStore.NoPickupPoints", "No pickup points are available");

            base.Install();
        }
        public IActionResult Create(StorePickupPointModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var address = new Address
            {
                Address1        = model.Address.Address1,
                City            = model.Address.City,
                County          = model.Address.County,
                CountryId       = model.Address.CountryId,
                StateProvinceId = model.Address.StateProvinceId,
                ZipPostalCode   = model.Address.ZipPostalCode,
                CreatedOnUtc    = DateTime.UtcNow
            };

            _addressService.InsertAddress(address);

            var pickupPoint = new StorePickupPoint
            {
                Name         = model.Name,
                Description  = model.Description,
                AddressId    = address.Id,
                OpeningHours = model.OpeningHours,
                PickupFee    = model.PickupFee,
                DisplayOrder = model.DisplayOrder,
                StoreId      = model.StoreId,
                Latitude     = model.Latitude,
                Longitude    = model.Longitude,
                TransitDays  = model.TransitDays
            };

            _storePickupPointService.InsertStorePickupPoint(pickupPoint);

            ViewBag.RefreshPage = true;

            return(View("~/Plugins/Pickup.PickupInStore/Views/Create.cshtml", model));
        }
Beispiel #12
0
        public ActionResult Create(string btnId, string formId, StorePickupPointModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
            {
                return(Content("Access denied"));
            }

            var address = new Address
            {
                Address1        = model.Address.Address1,
                City            = model.Address.City,
                CountryId       = model.Address.CountryId,
                StateProvinceId = model.Address.StateProvinceId,
                ZipPostalCode   = model.Address.ZipPostalCode,
                CreatedOnUtc    = DateTime.UtcNow
            };

            _addressService.InsertAddress(address);

            var pickupPoint = new StorePickupPoint
            {
                Name         = model.Name,
                Description  = model.Description,
                AddressId    = address.Id,
                OpeningHours = model.OpeningHours,
                PickupFee    = model.PickupFee,
                StoreId      = model.StoreId
            };

            _storePickupPointService.InsertStorePickupPoint(pickupPoint);

            ViewBag.RefreshPage = true;
            ViewBag.btnId       = btnId;
            ViewBag.formId      = formId;

            return(View("~/Plugins/Pickup.PickupInStore/Views/Create.cshtml", model));
        }
Beispiel #13
0
 /// <summary>
 /// Updates the pickup point
 /// </summary>
 /// <param name="pickupPoint">Pickup point</param>
 public virtual void UpdateStorePickupPoint(StorePickupPoint pickupPoint)
 {
     _storePickupPointRepository.Update(pickupPoint, false);
     _staticCacheManager.RemoveByPrefix(PICKUP_POINT_PATTERN_KEY);
 }
        /// <summary>
        /// Inserts a pickup point
        /// </summary>
        /// <param name="pickupPoint">Pickup point</param>
        public virtual async Task InsertStorePickupPointAsync(StorePickupPoint pickupPoint)
        {
            await _storePickupPointRepository.InsertAsync(pickupPoint, false);

            await _staticCacheManager.RemoveByPrefixAsync(PICKUP_POINT_PATTERN_KEY);
        }