private void ParseCategoryIds()
 {
     CategoryIds = WUQueryCategoryIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(str => str.Trim()).ToList();
     if (InstallWindowsOSOnlyUpdates)
     {
         CategoryIds.Add(WindowsOSOnlyCategoryId);
     }
 }
示例#2
0
        public override int GetHashCode()
        {
            int hashCode = 737510073;

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

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

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

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

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

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

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

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

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

            return(hashCode);
        }
        public async Task <ExecutionStatus <CategoryIds> > Run(Category entity)
        {
            using var connection = new SqliteConnection(_geekLemonContext.ConnectionString);

            //Nie ma SQL INjection
            var q = @"INSERT INTO Categories(Name, DisplayName, WhatWeAreLookingFor
                ,UniqueId, Version)
                VALUES (@Name, @DisplayName, @WhatWeAreLookingFor,@UniqueId, @Version);
                SELECT seq From sqlite_sequence Where Name='Categories'";

            try
            {
                var result = await connection.QueryAsync <int>(q,
                                                               new
                {
                    @Name                = entity.Name,
                    @DisplayName         = entity.DisplayName,
                    @WhatWeAreLookingFor = entity.WhatWeAreLookingFor,
                    @UniqueId            = entity.UniqueId.Value.ToString(),
                    @Version             = entity.Version,
                });

                //var cmd = connection.CreateCommand();
                //cmd.CommandText = "SELECT last_insert_rowid()";
                //Int64 i = (Int64)cmd.ExecuteScalar();

                int createdId = result.FirstOrDefault();

                CategoryIds ids = new CategoryIds()
                {
                    CreatedId = new CategoryId(createdId),
                    UniqueId  = entity.UniqueId
                };

                return(ExecutionStatus
                       <CategoryIds>
                       .DbOk(ids));
            }
            catch (Exception ex)
            {
                if (ExecutionFlow.Options.ThrowExceptions)
                {
                    throw;
                }

                return(ExecutionStatus
                       <CategoryIds>
                       .DbError(ex));
            }
        }
示例#4
0
        public WeProductBase(string categoryId, WeProductProperty property, string name, SkuInfo skuInfo,
                             string mainImg, string img, WeProductDetail detail)
            : this(name, mainImg)
        {
            TkDebug.AssertArgumentNullOrEmpty(categoryId, "categoryId", null);
            TkDebug.AssertArgumentNull(property, "property", null);
            TkDebug.AssertArgumentNull(skuInfo, "skuInfo", null);
            TkDebug.AssertArgumentNullOrEmpty(img, "img", null);
            TkDebug.AssertArgumentNull(detail, "detail", null);

            CategoryIds.Add(categoryId);
            Properties.Add(property);
            SkuInfos.Add(skuInfo);
            Imgs.Add(img);
            Details.Add(detail);
        }
示例#5
0
        public WeProductBase(string[] categoryIds, WeProductProperty[] propertys, string name, SkuInfo[] skuInfos,
                             string mainImg, string[] imgs, WeProductDetail[] details)
            : this(name, mainImg)
        {
            TkDebug.AssertArgumentNull(categoryIds, "categoryIds", null);
            TkDebug.AssertArgumentNull(propertys, "propertys", null);
            TkDebug.AssertArgumentNull(skuInfos, "propertys", null);
            TkDebug.AssertArgumentNull(imgs, "img", null);
            TkDebug.AssertArgumentNull(details, "details", null);

            CategoryIds.AddRange(categoryIds);
            Properties.AddRange(propertys);
            SkuInfos.AddRange(skuInfos);
            Imgs.AddRange(imgs);
            Details.AddRange(details);
        }
示例#6
0
         public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
         {
             if (bindingContext.ModelType != typeof(CategoryIds))
             {
                 return false;
             }
 
             var val = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
             if (val == null)
             {
                 return false;
             }
 
             var key = val.RawValue as string;
             if (key == null)
             {
                 bindingContext.ModelState.AddModelError(bindingContext.ModelName, "Wrong value type");
                 return false;
             }
 
             var values = val.AttemptedValue.Split(',');
             var ids = new List<int>();
             foreach (var value in values)
             {
                 int intValue;
                 int.TryParse(value.Trim(), out intValue);
                 if (intValue > 0)
                 {
                     ids.Add(intValue);
                 }
             }
 
             if (ids.Count > 0)
             {
                 var result = new CategoryIds
                 {
                     Ids= ids
                 };
 
                 bindingContext.Model = result;
                 return true;
             }
 
             bindingContext.ModelState.AddModelError(
                 bindingContext.ModelName, "Cannot convert value to Location");
             return false;
         }
示例#7
0
        private List <CategoryBook> CreateManyToManyRelationships(int bookId, RepositoryFactory repositoryFactory)
        {
            List <CategoryBook> categoryBooks =
                repositoryFactory.GetCategoryBookRepository()
                .GetModels()
                .Where(b => b.BookId == bookId)
                .ToList();

            foreach (var item in categoryBooks)
            {
                repositoryFactory.GetCategoryBookRepository().DeleteManyToMany(item);
            }

            return(CategoryIds
                   .Select(catId => new CategoryBook {
                BookId = bookId, CategoryId = catId
            })
                   .ToList());
        }
        private List <Models.CategorySpot> CreateManyToManyRelationships(int spotId, RepositoryFactory repositoryFactory)
        {
            List <Models.CategorySpot> categorySpots =
                repositoryFactory.GetCategorySpotRepository()
                .GetModels()
                .Where(s => s.SpotId == spotId)
                .ToList();

            foreach (var item in categorySpots)
            {
                repositoryFactory.GetCategorySpotRepository().DeleteManyToMany(item);
            }

            return(CategoryIds
                   .Select(catId => new Models.CategorySpot {
                SpotId = spotId, CategoryId = catId
            })
                   .ToList());
        }
示例#9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

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

            return(obj is SearchCatalogItemsRequest other &&
                   ((TextFilter == null && other.TextFilter == null) || (TextFilter?.Equals(other.TextFilter) == true)) &&
                   ((CategoryIds == null && other.CategoryIds == null) || (CategoryIds?.Equals(other.CategoryIds) == true)) &&
                   ((StockLevels == null && other.StockLevels == null) || (StockLevels?.Equals(other.StockLevels) == true)) &&
                   ((EnabledLocationIds == null && other.EnabledLocationIds == null) || (EnabledLocationIds?.Equals(other.EnabledLocationIds) == true)) &&
                   ((Cursor == null && other.Cursor == null) || (Cursor?.Equals(other.Cursor) == true)) &&
                   ((Limit == null && other.Limit == null) || (Limit?.Equals(other.Limit) == true)) &&
                   ((SortOrder == null && other.SortOrder == null) || (SortOrder?.Equals(other.SortOrder) == true)) &&
                   ((ProductTypes == null && other.ProductTypes == null) || (ProductTypes?.Equals(other.ProductTypes) == true)) &&
                   ((CustomAttributeFilters == null && other.CustomAttributeFilters == null) || (CustomAttributeFilters?.Equals(other.CustomAttributeFilters) == true)));
        }
示例#10
0
 public Statistic(CategoryIds category, Block block, int value)
 {
     CategoryId  = category;
     StatisticId = block.Id;
     Value       = value;
 }
 private List <CategoryRestaurant> CreateManyToManyRelationships(int restaurantId)
 {
     return(CategoryIds.Select(catId => new CategoryRestaurant {
         RestaurantId = restaurantId, CategoryId = catId
     }).ToList());
 }
 private List <CategoryLocation> CreateManyToManyRelationships(int locationId)
 {
     return(CategoryIds.Select(catId => new CategoryLocation {
         LocationId = locationId, CategoryId = catId
     }).ToList());
 }
 private List <Models.CategorySpot> CreateManyToManyRelationships(int spotId)
 {
     return(CategoryIds.Select(catId => new Models.CategorySpot {
         SpotId = spotId, CategoryId = catId
     }).ToList());
 }
示例#14
0
 public ESCreateCategoryCommandResponse(CategoryIds categoryIds)
     : base()
 {
     CategoryIds        = categoryIds;
     CategoryIds.Status = IdsStatus.DudeYouCantReturnCreatedIdWhenYouAreEventSourcing;
 }
示例#15
0
 public Statistic(CategoryIds category, Item item, int value)
 {
     CategoryId  = category;
     StatisticId = item.Id;
     Value       = value;
 }
示例#16
0
 public Statistic(CategoryIds category, Entity entity, int value)
 {
     CategoryId  = category;
     StatisticId = entity.EntityId;
     Value       = value;
 }
示例#17
0
 private List <CategoryBook> CreateManyToManyRelationships(int bookId)
 {
     return(CategoryIds.Select(catId => new CategoryBook {
         BookId = bookId, CategoryId = catId
     }).ToList());
 }
示例#18
0
 public Statistic(CategoryIds category, StatisticIds statistic, int value)
 {
     CategoryId  = category;
     StatisticId = (int)statistic;
     Value       = value;
 }
示例#19
0
        public DataSet SearchLessonsLearned()
        {
            ICustomDataAdapter da      = DataAccess.GetCustomDataAdapter();
            DataSet            results = new DataSet(); //make sure we use a loosely typed dataset as there will be more columns returned than just from the hedge table

            IDbCommand cmd;

            cmd             = DBConnection.CreateCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "LL_LEARNED_PKG.SEARCH_RECORD";

            CreateParameter(ref cmd, "userId", ParameterDirection.Input, DbType.String, "USER_ID");
            CreateParameter(ref cmd, "pkeywords", ParameterDirection.Input, DbType.String, "KEY_WORDS");
            CreateParameter(ref cmd, "psbuids", ParameterDirection.Input, DbType.String, "SBU_IDS");
            CreateParameter(ref cmd, "pbuids", ParameterDirection.Input, DbType.String, "BU_IDS");
            CreateParameter(ref cmd, "pprojectids", ParameterDirection.Input, DbType.String, "PROJECT_IDS");
            CreateParameter(ref cmd, "pprocessids", ParameterDirection.Input, DbType.String, "PROCESS_IDS");
            CreateParameter(ref cmd, "pdisciplineids", ParameterDirection.Input, DbType.String, "DISCIPLINE_IDS");
            CreateParameter(ref cmd, "pstageids", ParameterDirection.Input, DbType.String, "STAGE_IDS");
            CreateParameter(ref cmd, "pcategoryids", ParameterDirection.Input, DbType.String, "CATEGORY_IDS");

            ((IDbDataParameter)cmd.Parameters["userId"]).Value         = CurrentUser;
            ((IDbDataParameter)cmd.Parameters["pkeywords"]).Value      = KeyWords.ToString();
            ((IDbDataParameter)cmd.Parameters["psbuids"]).Value        = SBUIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pbuids"]).Value         = BUIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pprojectids"]).Value    = ProjectIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pprocessids"]).Value    = ProcessIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pdisciplineids"]).Value = DisciplineIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pstageids"]).Value      = StageIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pcategoryids"]).Value   = CategoryIds.ToString();

            try
            {
                da.SelectCommand = cmd;
                da.Fill(results);
            }
            catch (Exception ex)
            {
                //If we get an error opening the result for the stored
                //procedure, we likely have a a farily major problem.
                //Permissions issues or something of the kind.  We will
                //percolate the call back up the stack so the front end
                //may report it and thus the user can log the error
                //for repair.
                throw ex;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Connection.Close();
                    cmd.Connection.Dispose();
                    cmd.Dispose();
                    cmd = null;
                }

                if (da != null)
                {
                    da.Dispose();
                    da = null;
                }
            }

            return(results);
        }