Beispiel #1
0
        public void FillWorkersStatistic(WorkplaceStatistic someWorkPlaceStat)
        {
            someWorkPlaceStat.WorkersStatistics.Clear();
            WorkerOperations workerOp = new WorkerOperations(db);

            foreach (Worker item in someWorkPlaceStat.WorkPlace.Workers)
            {
                WorkerStatistic someWorkerStat = workerOp.FillWorkerStatistic(item);
                someWorkPlaceStat.WorkersStatistics.Add(someWorkerStat);
            }
        }
Beispiel #2
0
        private string GetDetailedTreeMapData(CitiesStatistic someSitiesStat)
        {
            // full value of data parameter. Should be quoted in view
            string result = "[";             //  "data": [

            result += "{            \"label\": \"Україна\",       \"fillcolor\": \"8c8c8c\",  \"value\": \"" + someSitiesStat.TotalServicesProvided + "\",      \"data\":       \r\n\t[ ";


            foreach (CityStatistic city in someSitiesStat.CitiesStats)
            {
                result += " \r\n\t{\r\n\t\t\"label\": \"" + city.City.Name + "\",    \"fillcolor\": \"8c8c8c\",  \"value\": \"" + city.ServicesProvided + "\", \"data\": \r\n\t\t[\r\n";


                IEnumerable <Worker> someWorkers = db.Workers.Where(m => m.WorkPlace.Division.Organization.CityId == city.City.Id).OrderByDescending(m => m.ServicesToClients.Count());

                foreach (Worker worker in someWorkers)
                {
                    WorkerOperations workerOp       = new WorkerOperations(db);
                    WorkerStatistic  someWorkerStat = workerOp.FillWorkerStatistic(worker);

                    result += "\r\n\t\t\t{\r\n \t\t\t\t\"label\": \"" + worker.AspNetUser.Name + "\",  \"value\": \"" + worker.ServicesToClients.Where(m => m.ValueSet.HasValue).Count() + "\",  \"sValue\": \"" + someWorkerStat.SummaryIndex.ToString("0.#") + "\" ";
                    result += "\r\n\t\t\t}\r\n\t\t\t ,";
                }

                /*
                 * result += "\r\n\t\t\t{\r\n \t\t\t\t\"label\": \"" + organization.Name + "\",  \"value\": \"" + orgStat.TotalServices + "\",  \"sValue\": \"" + orgStat.SummaryIndex.ToString("0.#") + "\" ";
                 * result += "\r\n\t\t\t}\r\n\t\t\t ,";
                 */


                result  = result.TrimEnd(',');
                result += "\r\n\t\t]\r\n \r\n\t}\r\n\t ,";                 // data of city
            }
            result  = result.TrimEnd(',');
            result += "\r\n\t]}\r\n]\r\n";

            result += ",\r\n \"colorrange\": {        \"mapbypercent\": \"1\",        \"gradient\": \"1\",        \"minvalue\": \"0\",        \"code\": ";

            result += "   \"7FFF00\",        \"startlabel\": \"Позитивно\",      \"endlabel\": \"Негативно\",        \"color\": [            {";
            result += "\"code\": \"EE0000\",                \"maxvalue\": \"100\",                \"label\": \"Static\"            },            {                \"code\": \"7FFF00\",                \"maxvalue\": \"100\",                \"label\": \"AVERAGE\"            }        ]    }  ";


            return(result);
        }