public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Active")] PricingType pricingType)
        {
            if (id != pricingType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pricingType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PricingTypeExists(pricingType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pricingType));
        }
 public PricingMatrix()
 {
     carrierId = Enums.CarrierDatabaseKey.NONE;
     pricingOptions = new List<KeyValuePair<string, PricingOption>>();
     zoneInfo = new List<Tuple<string, string, int>>();
     pricingType = PricingType.REGULAR;
 }
Example #3
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogItemVariation other &&
                   ((ItemId == null && other.ItemId == null) || (ItemId?.Equals(other.ItemId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Sku == null && other.Sku == null) || (Sku?.Equals(other.Sku) == true)) &&
                   ((Upc == null && other.Upc == null) || (Upc?.Equals(other.Upc) == true)) &&
                   ((Ordinal == null && other.Ordinal == null) || (Ordinal?.Equals(other.Ordinal) == true)) &&
                   ((PricingType == null && other.PricingType == null) || (PricingType?.Equals(other.PricingType) == true)) &&
                   ((PriceMoney == null && other.PriceMoney == null) || (PriceMoney?.Equals(other.PriceMoney) == true)) &&
                   ((LocationOverrides == null && other.LocationOverrides == null) || (LocationOverrides?.Equals(other.LocationOverrides) == true)) &&
                   ((TrackInventory == null && other.TrackInventory == null) || (TrackInventory?.Equals(other.TrackInventory) == true)) &&
                   ((InventoryAlertType == null && other.InventoryAlertType == null) || (InventoryAlertType?.Equals(other.InventoryAlertType) == true)) &&
                   ((InventoryAlertThreshold == null && other.InventoryAlertThreshold == null) || (InventoryAlertThreshold?.Equals(other.InventoryAlertThreshold) == true)) &&
                   ((UserData == null && other.UserData == null) || (UserData?.Equals(other.UserData) == true)) &&
                   ((ServiceDuration == null && other.ServiceDuration == null) || (ServiceDuration?.Equals(other.ServiceDuration) == true)) &&
                   ((AvailableForBooking == null && other.AvailableForBooking == null) || (AvailableForBooking?.Equals(other.AvailableForBooking) == true)) &&
                   ((ItemOptionValues == null && other.ItemOptionValues == null) || (ItemOptionValues?.Equals(other.ItemOptionValues) == true)) &&
                   ((MeasurementUnitId == null && other.MeasurementUnitId == null) || (MeasurementUnitId?.Equals(other.MeasurementUnitId) == true)) &&
                   ((TeamMemberIds == null && other.TeamMemberIds == null) || (TeamMemberIds?.Equals(other.TeamMemberIds) == true)));
        }
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"LocationId = {(LocationId == null ? "null" : LocationId == string.Empty ? "" : LocationId)}");
     toStringOutput.Add($"PriceMoney = {(PriceMoney == null ? "null" : PriceMoney.ToString())}");
     toStringOutput.Add($"PricingType = {(PricingType == null ? "null" : PricingType.ToString())}");
     toStringOutput.Add($"TrackInventory = {(TrackInventory == null ? "null" : TrackInventory.ToString())}");
     toStringOutput.Add($"InventoryAlertType = {(InventoryAlertType == null ? "null" : InventoryAlertType.ToString())}");
     toStringOutput.Add($"InventoryAlertThreshold = {(InventoryAlertThreshold == null ? "null" : InventoryAlertThreshold.ToString())}");
 }
        public async Task <IActionResult> Create([Bind("Id,Name,Active")] PricingType pricingType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pricingType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pricingType));
        }
Example #6
0
        public void Update(
            string name, string description, ApplicationType applicationType, decimal minimumRate, UpchargeType upchargeType,
            decimal upchargeValue, PricingType pricingType, DateTime expirationDate)
        {
            Name            = name;
            Description     = description;
            ApplicationType = applicationType;
            MinimumRate     = minimumRate;
            UpchargeType    = upchargeType;
            UpchargeValue   = upchargeValue;
            PricingType     = pricingType;
            ExpirationDate  = expirationDate;

            LastModified = DateTime.UtcNow;
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is ItemVariationLocationOverrides other &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((PriceMoney == null && other.PriceMoney == null) || (PriceMoney?.Equals(other.PriceMoney) == true)) &&
                   ((PricingType == null && other.PricingType == null) || (PricingType?.Equals(other.PricingType) == true)) &&
                   ((TrackInventory == null && other.TrackInventory == null) || (TrackInventory?.Equals(other.TrackInventory) == true)) &&
                   ((InventoryAlertType == null && other.InventoryAlertType == null) || (InventoryAlertType?.Equals(other.InventoryAlertType) == true)) &&
                   ((InventoryAlertThreshold == null && other.InventoryAlertThreshold == null) || (InventoryAlertThreshold?.Equals(other.InventoryAlertThreshold) == true)));
        }
Example #8
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"ItemId = {(ItemId == null ? "null" : ItemId == string.Empty ? "" : ItemId)}");
     toStringOutput.Add($"Name = {(Name == null ? "null" : Name == string.Empty ? "" : Name)}");
     toStringOutput.Add($"Sku = {(Sku == null ? "null" : Sku == string.Empty ? "" : Sku)}");
     toStringOutput.Add($"Upc = {(Upc == null ? "null" : Upc == string.Empty ? "" : Upc)}");
     toStringOutput.Add($"Ordinal = {(Ordinal == null ? "null" : Ordinal.ToString())}");
     toStringOutput.Add($"PricingType = {(PricingType == null ? "null" : PricingType.ToString())}");
     toStringOutput.Add($"PriceMoney = {(PriceMoney == null ? "null" : PriceMoney.ToString())}");
     toStringOutput.Add($"LocationOverrides = {(LocationOverrides == null ? "null" : $"[{ string.Join(", ", LocationOverrides)} ]")}");
     toStringOutput.Add($"TrackInventory = {(TrackInventory == null ? "null" : TrackInventory.ToString())}");
     toStringOutput.Add($"InventoryAlertType = {(InventoryAlertType == null ? "null" : InventoryAlertType.ToString())}");
     toStringOutput.Add($"InventoryAlertThreshold = {(InventoryAlertThreshold == null ? "null" : InventoryAlertThreshold.ToString())}");
     toStringOutput.Add($"UserData = {(UserData == null ? "null" : UserData == string.Empty ? "" : UserData)}");
     toStringOutput.Add($"ServiceDuration = {(ServiceDuration == null ? "null" : ServiceDuration.ToString())}");
     toStringOutput.Add($"AvailableForBooking = {(AvailableForBooking == null ? "null" : AvailableForBooking.ToString())}");
     toStringOutput.Add($"ItemOptionValues = {(ItemOptionValues == null ? "null" : $"[{ string.Join(", ", ItemOptionValues)} ]")}");
     toStringOutput.Add($"MeasurementUnitId = {(MeasurementUnitId == null ? "null" : MeasurementUnitId == string.Empty ? "" : MeasurementUnitId)}");
     toStringOutput.Add($"TeamMemberIds = {(TeamMemberIds == null ? "null" : $"[{ string.Join(", ", TeamMemberIds)} ]")}");
 }
        public override int GetHashCode()
        {
            int hashCode = -598612092;

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (PriceMoney != null)
            {
                hashCode += PriceMoney.GetHashCode();
            }

            if (PricingType != null)
            {
                hashCode += PricingType.GetHashCode();
            }

            if (TrackInventory != null)
            {
                hashCode += TrackInventory.GetHashCode();
            }

            if (InventoryAlertType != null)
            {
                hashCode += InventoryAlertType.GetHashCode();
            }

            if (InventoryAlertThreshold != null)
            {
                hashCode += InventoryAlertThreshold.GetHashCode();
            }

            return(hashCode);
        }
 public PricingMatrix(Enums.CarrierDatabaseKey carrier_id)
 {
     this.carrierId = carrier_id;
     pricingType = carrier_id == Enums.CarrierDatabaseKey.TOLL ? PricingType.TOLL : PricingType.REGULAR;
     setup();
 }
Example #11
0
        public void Initializar()
        {
            try
            {
                if (_db.Database.GetPendingMigrations().Count() > 0)
                {
                    _db.Database.Migrate();
                }
            }
            catch (Exception ex)
            {
            }

            if (_roleManager.RoleExistsAsync(SD.AdminUser).GetAwaiter().GetResult())
            {
                return;
            }

            // Creating User Roles
            _roleManager.CreateAsync(new IdentityRole(SD.AdminUser)).GetAwaiter().GetResult();
            _roleManager.CreateAsync(new IdentityRole(SD.SupervisorUser)).GetAwaiter().GetResult();
            _roleManager.CreateAsync(new IdentityRole(SD.BnasStoreUser)).GetAwaiter().GetResult();
            _roleManager.CreateAsync(new IdentityRole(SD.YaseenStoreUser)).GetAwaiter().GetResult();

            // Create Admin User
            _userManager.CreateAsync(new ApplicationUser
            {
                UserName       = "******",
                Email          = "*****@*****.**",
                EmailConfirmed = true,
                PhoneNumber    = "1233456456",
                FirstName      = "Bnas admin"
            }, "Qwer!234"
                                     ).GetAwaiter().GetResult();

            // assign role to admin user
            IdentityUser user = _db.ApplicationUser.FirstOrDefaultAsync(u => u.Email == "*****@*****.**").GetAwaiter().GetResult();

            _userManager.AddToRoleAsync(user, SD.AdminUser).GetAwaiter().GetResult();

            // Creating Price Types (Retail price and wholesales price)
            PricingType RPrices = new PricingType
            {
                PriceType = SD.RetailPrice
            };

            PricingType WPrices = new PricingType
            {
                PriceType = SD.WholePrice
            };

            _db.PricingType.Add(RPrices);
            _db.PricingType.Add(WPrices);

            // Create Authentication Roles for Supervisor
            RoleAuth Auth = new RoleAuth
            {
                RoleName      = SD.SupervisorUser,
                AppTransReq   = false,
                CreateInGoods = false
            };

            _db.RoleAuth.Add(Auth);

            // Create Wh types (showrooms and store rooms)
            WhType ShowRoom = new WhType
            {
                Type = SD.ShowRoom
            };

            WhType StoreRoom = new WhType
            {
                Type = SD.StoreRoom
            };

            _db.WhType.Add(ShowRoom);
            _db.WhType.Add(StoreRoom);


            // save all changes
            _db.SaveChangesAsync();
        }
Example #12
0
 public Movie(string title, PricingType pricingType)
 {
     Title       = title;
     PricingType = pricingType;
 }
Example #13
0
        public override int GetHashCode()
        {
            int hashCode = -1155387790;

            if (ItemId != null)
            {
                hashCode += ItemId.GetHashCode();
            }

            if (Name != null)
            {
                hashCode += Name.GetHashCode();
            }

            if (Sku != null)
            {
                hashCode += Sku.GetHashCode();
            }

            if (Upc != null)
            {
                hashCode += Upc.GetHashCode();
            }

            if (Ordinal != null)
            {
                hashCode += Ordinal.GetHashCode();
            }

            if (PricingType != null)
            {
                hashCode += PricingType.GetHashCode();
            }

            if (PriceMoney != null)
            {
                hashCode += PriceMoney.GetHashCode();
            }

            if (LocationOverrides != null)
            {
                hashCode += LocationOverrides.GetHashCode();
            }

            if (TrackInventory != null)
            {
                hashCode += TrackInventory.GetHashCode();
            }

            if (InventoryAlertType != null)
            {
                hashCode += InventoryAlertType.GetHashCode();
            }

            if (InventoryAlertThreshold != null)
            {
                hashCode += InventoryAlertThreshold.GetHashCode();
            }

            if (UserData != null)
            {
                hashCode += UserData.GetHashCode();
            }

            if (ServiceDuration != null)
            {
                hashCode += ServiceDuration.GetHashCode();
            }

            if (AvailableForBooking != null)
            {
                hashCode += AvailableForBooking.GetHashCode();
            }

            if (ItemOptionValues != null)
            {
                hashCode += ItemOptionValues.GetHashCode();
            }

            if (MeasurementUnitId != null)
            {
                hashCode += MeasurementUnitId.GetHashCode();
            }

            if (TeamMemberIds != null)
            {
                hashCode += TeamMemberIds.GetHashCode();
            }

            return(hashCode);
        }