示例#1
0
        /// <summary>
        /// Deletes the locaton.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <param name="userId">The user identifier.</param>
        public void DeleteLocaton(Data.Location location, int userId)
        {
            InventoryBL inventoryBL = new InventoryBL(DataContext);

            location.IsActive            = false;
            location.LastUpdatedByUserId = userId;
            location.LastUpdatedDate     = Utils.Now;

            if (!location.ParentLocationId.HasValue)
            {
                List <CompanyUserRole> locationUserRoles = inventoryBL.GetInventoryRolesByLocationId(location.LocationId);
                foreach (CompanyUserRole locationUserRole in locationUserRoles)
                {
                    locationUserRole.IsActive = false;
                }
            }

            DataContext.SaveChanges();
        }