/// <summary> /// Inserts a pickup point /// </summary> /// <param name="pickupPoint">Pickup point</param> public virtual void InsertStorePickupPoint(StorePickupPoint pickupPoint) { if (pickupPoint == null) throw new ArgumentNullException("pickupPoint"); _storePickupPointRepository.Insert(pickupPoint); _cacheManager.RemoveByPattern(PICKUP_POINT_PATTERN_KEY); }
/// <summary> /// Install the plugin /// </summary> public override void Install() { //database objects _objectContext.Install(); //sample pickup point var country = _countryService.GetCountryByThreeLetterIsoCode("USA"); var address = new Address { Address1 = "21 West 52nd Street", City = "New York", CountryId = country != null ? (int?)country.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 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, 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/PickupInStore/Create.cshtml", model); }