Example #1
0
        /// <summary>
        /// Gibt eine Liste aller Dateiverknüpfungen für das angegebene Element zurück.
        /// </summary>
        /// <param name="linkedItemPK">Primärschlüssel des verknüpften Elements.</param>
        /// <returns></returns>
        public SBList <FileLink> GetFileLinkList(string linkedItemPK)
        {
            if (this.myFileLinkDictionary.ContainsKey(linkedItemPK))
            {
                return(this.myFileLinkDictionary[linkedItemPK]);
            }

            var list  = new SBList <FileLink>();
            var fRows = DataManager.FileLinkDataService.GetFileLinkRows(linkedItemPK);

            if (fRows != null)
            {
                foreach (var fRow in fRows)
                {
                    if (list.Count(f => f.FullName == fRow.FullName) == 0)
                    {
                        list.Add(new FileLink(fRow));
                    }
                }
                if (list.Count > 0)
                {
                    this.myFileLinkDictionary.Add(linkedItemPK, list);
                    return(list);
                }
            }
            return(null);
        }
Example #2
0
        double GetAverageProductSales(SBList <Model.Services.ProductService.ProductSale> salesList)
        {
            if (salesList.Count == 0)
            {
                return(0);
            }
            var count = salesList.Count();
            var sum   = salesList.Sum(s => s.Menge);

            return(sum / count);
        }