Esempio n. 1
0
        public OPResult SearchData()
        {
            if (StorageID == default(int))
            {
                return(new OPResult {
                    IsSucceed = false, Message = "请选择分货仓库."
                });
            }
            //if (OrganizationIDArray == null || OrganizationIDArray.Count() == 0)
            //{
            //    return new OPResult { IsSucceed = false, Message = "请选择分货机构." };
            //}
            if (Styles == null || Styles.Count() == 0)
            {
                return(new OPResult {
                    IsSucceed = false, Message = "请选择分货款式."
                });
            }
            var stocks = ReportDataContext.GetAvailableStock(StorageID, Styles);
            var pids   = stocks.Select(o => o.ProductID);
            var orders = this.GetSubordinateOrderAggregation(pids);
            var table  = this.GenerateDataTable(orders);

            pids = orders.Select(o => o.ProductID).Distinct();//可用库存和订单交集的productid
            var products = _linqOP.Search <ViewProduct>(o => pids.Contains(o.ProductID)).ToList().OrderBy(o => o.ProductCode);

            foreach (var p in products)
            {
                DataRow row = table.NewRow();
                table.Rows.Add(row);
                row["SKU码"]   = p.ProductCode;
                row["品牌"]     = VMGlobal.PoweredBrands.Find(o => o.ID == p.BrandID).Code;
                row["款号"]     = p.StyleCode;
                row["色号"]     = VMGlobal.Colors.Find(o => o.ID == p.ColorID).Code;
                row["尺码"]     = VMGlobal.Sizes.Find(o => o.ID == p.SizeID).Name;
                row["剩余可用库存"] = row["可用库存"] = stocks.First(s => s.ProductID == p.ProductID).Quantity;
                for (int i = 6; i < table.Columns.Count - 1; i++)
                {
                    var on    = table.Columns[i].ColumnName;
                    var order = orders.FirstOrDefault(o => o.ProductID == p.ProductID && o.OrganizationName == on);
                    if (order != null)
                    {
                        row[on] = order.Quantity;
                    }
                }
            }
            Entities = table.DefaultView;
            return(new OPResult {
                IsSucceed = true
            });
        }
Esempio n. 2
0
        protected override UriQuery GetUriQuery()
        {
            UriQuery query = base.GetUriQuery();

            if (!string.IsNullOrEmpty(ArtistPick))
            {
                query.Add("artist_pick", ArtistPick);
            }

            if (Variety.HasValue)
            {
                query.Add("variety", Variety.Value);
            }

            if (!string.IsNullOrEmpty(Distribution))
            {
                query.Add("distribution", Distribution);
            }

            if (Adventurousness.HasValue)
            {
                query.Add("adventurousness", Adventurousness.Value);
            }

            if (!string.IsNullOrEmpty(SeedCatalog))
            {
                query.Add("seed_catalog", SeedCatalog);
            }

            if (Description.Count() > 0)
            {
                foreach (Term description in Description)
                {
                    query.Add("description", description);
                }
            }

            if (Styles.Count() > 0)
            {
                foreach (Term style in Styles)
                {
                    query.Add("style", style);
                }
            }

            if (Moods.Count() > 0)
            {
                foreach (Term mood in Moods)
                {
                    query.Add("mood", mood);
                }
            }

            if (MaxTempo.HasValue)
            {
                query.Add("max_tempo", MaxTempo.Value);
            }

            if (MinTempo.HasValue)
            {
                query.Add("min_tempo", MinTempo.Value);
            }

            if (MaxLoudness.HasValue)
            {
                query.Add("max_loudness", MaxLoudness.Value);
            }

            if (MinLoudness.HasValue)
            {
                query.Add("min_loudness", MinLoudness.Value);
            }

            if (ArtistMaxFamiliarity.HasValue)
            {
                query.Add("artist_max_familiarity", ArtistMaxFamiliarity.Value);
            }

            if (ArtistMinFamiliarity.HasValue)
            {
                query.Add("artist_min_familiarity", ArtistMinFamiliarity.Value);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearAfter))
            {
                query.Add("artist_end_year_after", ArtistEndYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearBefore))
            {
                query.Add("artist_end_year_before", ArtistEndYearBefore);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearAfter))
            {
                query.Add("artist_start_year_after", ArtistStartYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearBefore))
            {
                query.Add("artist_start_year_before", ArtistStartYearBefore);
            }

            if (SongMaxHotttnesss.HasValue)
            {
                query.Add("song_max_hotttnesss", SongMaxHotttnesss.Value);
            }

            if (SongMinHotttnesss.HasValue)
            {
                query.Add("song_min_hotttnesss", SongMinHotttnesss.Value);
            }

            if (ArtistMaxHotttnesss.HasValue)
            {
                query.Add("artist_max_hotttnesss", ArtistMaxHotttnesss.Value);
            }

            if (ArtistMinHotttnesss.HasValue)
            {
                query.Add("artist_min_hotttnesss", ArtistMinHotttnesss.Value);
            }

            if (MaxLongitude.HasValue)
            {
                query.Add("max_longitude", MaxLongitude.Value);
            }

            if (MinLongitude.HasValue)
            {
                query.Add("min_longitude", MinLongitude.Value);
            }

            if (MaxLatitude.HasValue)
            {
                query.Add("max_latitude", MaxLatitude.Value);
            }

            if (MinLatitude.HasValue)
            {
                query.Add("min_latitude", MinLatitude.Value);
            }

            if (MaxDanceability.HasValue)
            {
                query.Add("max_danceability", MaxDanceability.Value);
            }

            if (MinDanceability.HasValue)
            {
                query.Add("min_danceability", MinDanceability.Value);
            }

            if (MaxEnergy.HasValue)
            {
                query.Add("max_energy", MaxEnergy.Value);
            }

            if (MinEnergy.HasValue)
            {
                query.Add("min_energy", MinEnergy.Value);
            }

            if (!string.IsNullOrEmpty(Mode))
            {
                query.Add("mode", Mode);
            }

            if (!string.IsNullOrEmpty(Key))
            {
                query.Add("key", Key);
            }

            if (!string.IsNullOrEmpty(Sort))
            {
                query.Add("sort", Sort);
            }

            return(query);
        }
        //.....................................................................
        /// <summary>
        ///
        /// https://docs.microsoft.com/en-us/office/open-xml/how-to-apply-a-style-to-a-paragraph-in-a-word-processing-docxname
        ///
        /// Create a new style with the specified styleid and stylename and add it to the specified
        /// style definitions wbookpart.
        ///
        /// 追加一个新的额 STYLE , 样式。
        /// </summary>
        /// <param name="styleDefinitionsPart"></param>
        /// <param name="styleid"></param>
        /// <param name="stylename"></param>
        private void AddNewStyle(StyleDefinitionsPart styleDefinitionsPart, string styleid, string stylename)
        {
            // Get access to the root element of the styles wbookpart.
            //
            Styles styles = styleDefinitionsPart.Styles;

            //  test  test  test  test  test
            //
            foreach (Style stt in styles)
            {
                Console.WriteLine(stt.StyleName + "; " + stt.StyleId);
            }
            Console.WriteLine("styles.Count = " + styles.Count( ));

            // Create a new paragraph style and specify some of the properties.
            //
            Style style = new Style( )
            {
                Type        = StyleValues.Paragraph,
                StyleId     = styleid,
                CustomStyle = true
            };

            StyleName styleName1 = new StyleName( )
            {
                Val = stylename
            };
            BasedOn basedOn1 = new BasedOn( )
            {
                Val = "Normal"
            };

            NextParagraphStyle nextParagraphStyle1 = new NextParagraphStyle( )
            {
                Val = "Normal"
            };

            style.Append(styleName1);
            style.Append(basedOn1);
            style.Append(nextParagraphStyle1);

            //---------------------------------------------
            Bold bold1 = new Bold( );

            Color color1 = new Color( )
            {
                ThemeColor = ThemeColorValues.Accent2
            };

            RunFonts font1 = new RunFonts( )
            {
                Ascii = "Lucida Console"
            };

            Italic italic1 = new Italic( );

            // Specify a 12 point size.
            FontSize fontSize1 = new FontSize( )
            {
                Val = "24"
            };

            // Create the StyleRunProperties object and specify some of the run properties.
            StyleRunProperties styleRunProperties1 = new StyleRunProperties( );

            styleRunProperties1.Append(bold1);
            styleRunProperties1.Append(color1);
            styleRunProperties1.Append(font1);
            styleRunProperties1.Append(fontSize1);
            styleRunProperties1.Append(italic1);

            //---------------------------------------------
            // Add the run properties to the style.
            style.Append(styleRunProperties1);

            // Add the style to the styles wbookpart.
            styles.Append(style);

            return;
        }
Esempio n. 4
0
        public override string ToString()
        {
            UriQuery query = new UriQuery(BaseUrl);

            query.Add("api_key", ApiKey);
            query.Add("format", "json");

            if (!string.IsNullOrEmpty(Name))
            {
                query.Add("name", Name);
            }

            if (Styles.Count() > 0)
            {
                foreach (var style in Styles)
                {
                    query.Add("style", style);
                }
            }

            if (Moods.Count() > 0)
            {
                foreach (var mood in Moods)
                {
                    query.Add("mood", mood);
                }
            }

            if (!string.IsNullOrEmpty(ArtistEndYearAfter))
            {
                query.Add("artist_end_year_after", ArtistEndYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearBefore))
            {
                query.Add("artist_end_year_before", ArtistEndYearBefore);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearAfter))
            {
                query.Add("artist_start_year_after", ArtistStartYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearBefore))
            {
                query.Add("artist_start_year_before", ArtistStartYearBefore);
            }

            if (Bucket.HasValue)
            {
                foreach (var bucket in Bucket.Value.GetBucketDescriptions())
                {
                    query.Add("bucket", bucket);
                }
            }

            if (Description.Count() > 0)
            {
                foreach (var description in Description)
                {
                    query.Add("description", description);
                }
            }

            if (FuzzyMatch.HasValue)
            {
                query.Add("fuzzy_match", FuzzyMatch.Value);
            }

            if (Limit.HasValue)
            {
                query.Add("limit", Limit.Value);
            }

            if (MaxFamiliarity.HasValue)
            {
                query.Add("max_familiarity", MaxFamiliarity.Value);
            }

            if (MinFamiliarity.HasValue)
            {
                query.Add("min_familiarity", MinFamiliarity.Value);
            }

            if (MaxHotttnesss.HasValue)
            {
                query.Add("max_hotttnesss", MaxHotttnesss.Value);
            }

            if (MinHotttnesss.HasValue)
            {
                query.Add("min_hotttnesss", MinHotttnesss.Value);
            }

            if (RankType.HasValue)
            {
                query.Add("rank_type", RankType.Value.ToString().ToLower());
            }

            if (Results.HasValue)
            {
                query.Add("results", Results.Value);
            }

            if (Start.HasValue)
            {
                query.Add("start", Start.Value);
            }

            if (Sort.HasValue)
            {
                query.Add("sort", EnumHelpers.GetDescription(Sort.Value));
            }

            return(query.ToString());
        }
Esempio n. 5
0
        public override string ToString()
        {
            UriQuery query = new UriQuery(BaseUrl);

            query.Add("api_key", ApiKey);
            query.Add("format", "json");

            if (!string.IsNullOrEmpty(Title))
            {
                query.Add("title", Title);
            }

            if (!string.IsNullOrEmpty(Artist))
            {
                query.Add("artist", Artist);
            }

            if (!string.IsNullOrEmpty(Combined))
            {
                query.Add("combined", Combined);
            }

            if (Description.Count() > 0)
            {
                foreach (var description in Description)
                {
                    query.Add("description", description);
                }
            }

            if (Styles.Count() > 0)
            {
                foreach (var style in Styles)
                {
                    query.Add("style", style);
                }
            }

            if (Moods.Count() > 0)
            {
                foreach (var mood in Moods)
                {
                    query.Add("mood", mood);
                }
            }

            if (!string.IsNullOrEmpty(RankType))
            {
                query.Add("rank_type", RankType);
            }

            if (!string.IsNullOrEmpty(ArtistID))
            {
                query.Add("artist_id", ArtistID);
            }

            if (Results.HasValue)
            {
                query.Add("results", Results.Value);
            }

            if (Start.HasValue)
            {
                query.Add("start", Start.Value);
            }

            if (MaxTempo.HasValue)
            {
                query.Add("max_tempo", MaxTempo.Value);
            }

            if (MinTempo.HasValue)
            {
                query.Add("min_tempo", MinTempo.Value);
            }

            if (MaxLoudness.HasValue)
            {
                query.Add("max_loudness", MaxLoudness.Value);
            }

            if (MinLoudness.HasValue)
            {
                query.Add("min_loudness", MinLoudness.Value);
            }

            if (ArtistMaxFamiliarity.HasValue)
            {
                query.Add("artist_max_familiarity", ArtistMaxFamiliarity.Value);
            }

            if (ArtistMinFamiliarity.HasValue)
            {
                query.Add("artist_min_familiarity", ArtistMinFamiliarity.Value);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearAfter))
            {
                query.Add("artist_end_year_after", ArtistEndYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistEndYearBefore))
            {
                query.Add("artist_end_year_before", ArtistEndYearBefore);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearAfter))
            {
                query.Add("artist_start_year_after", ArtistStartYearAfter);
            }

            if (!string.IsNullOrEmpty(ArtistStartYearBefore))
            {
                query.Add("artist_start_year_before", ArtistStartYearBefore);
            }

            if (SongMaxHotttnesss.HasValue)
            {
                query.Add("song_max_hotttnesss", SongMaxHotttnesss.Value);
            }

            if (SongMinHotttnesss.HasValue)
            {
                query.Add("song_min_hotttnesss", SongMinHotttnesss.Value);
            }

            if (ArtistMaxHotttnesss.HasValue)
            {
                query.Add("artist_max_hotttnesss", ArtistMaxHotttnesss.Value);
            }

            if (ArtistMinHotttnesss.HasValue)
            {
                query.Add("artist_min_hotttnesss", ArtistMinHotttnesss.Value);
            }

            if (MaxLongitude.HasValue)
            {
                query.Add("max_longitude", MaxLongitude.Value);
            }

            if (MinLongitude.HasValue)
            {
                query.Add("min_longitude", MinLongitude.Value);
            }

            if (MaxLatitude.HasValue)
            {
                query.Add("max_latitude", MaxLatitude.Value);
            }

            if (MinLatitude.HasValue)
            {
                query.Add("min_latitude", MinLatitude.Value);
            }

            if (MaxDanceability.HasValue)
            {
                query.Add("max_danceability", MaxDanceability.Value);
            }

            if (MinDanceability.HasValue)
            {
                query.Add("min_danceability", MinDanceability.Value);
            }

            if (MaxEnergy.HasValue)
            {
                query.Add("max_energy", MaxEnergy.Value);
            }

            if (MinEnergy.HasValue)
            {
                query.Add("min_energy", MinEnergy.Value);
            }

            if (!string.IsNullOrEmpty(Mode))
            {
                query.Add("mode", Mode);
            }

            if (!string.IsNullOrEmpty(Key))
            {
                query.Add("key", Key);
            }

            if (Bucket.HasValue)
            {
                foreach (var bucket in Bucket.Value.GetBucketDescriptions())
                {
                    query.Add("bucket", bucket);
                }
            }

            if (!string.IsNullOrEmpty(Sort))
            {
                query.Add("sort", Sort);
            }

            if (Limit.HasValue)
            {
                query.Add("limit", Limit.Value.ToString().ToLower());
            }

            return(query.ToString());
        }