Exemple #1
0
        public static List <PieChartData> GetOpenedDocumentsStatByType(int currentSellerId)
        {
            var items = new List <PieChartData>();

            var statsFromDB = Interlex.DataLayer.DB.GetOpenedDocumentsStatByType(currentSellerId);

            foreach (var r in statsFromDB)
            {
                var item = new PieChartData();

                if (r["type_id"].ToString() == "3")
                {
                    if (r["product_id"].ToString() == "1")
                    {
                        item.Label = "Legal Doctrine";
                    }
                    else if (r["product_id"].ToString() == "2")
                    {
                        item.Label = "Finance doc";
                    }

                    item.Data = int.Parse(r["count"].ToString());
                    items.Add(item);
                }
                else
                {
                    if (items.Any(i => i.Label == r["type_id"].ToString()))
                    {
                        var curMemorizedItem = items.Where(i => i.Label == r["type_id"].ToString()).FirstOrDefault();
                        items.Remove(curMemorizedItem);
                        curMemorizedItem.Data += int.Parse(r["count"].ToString());
                        curMemorizedItem.Label = r["type_id"].ToString();
                        items.Add(curMemorizedItem);
                    }
                    else
                    {
                        item.Data  = int.Parse(r["count"].ToString());
                        item.Label = r["type_id"].ToString();
                        items.Add(item);
                    }
                }
            }

            return(items);
        }
Exemple #2
0
        public static List <PieChartData> GetOpenedDocumentsStatByLanguage(int currentSellerId)
        {
            var items = new List <PieChartData>();

            var statsFromDB = Interlex.DataLayer.DB.GetOpenedDocumentsStatByLanguage(currentSellerId);

            foreach (var r in statsFromDB)
            {
                var item = new PieChartData();

                item.Label = r["lang_name"].ToString();
                item.Data  = int.Parse(r["count"].ToString());

                items.Add(item);
            }

            return(items);
        }