Exemplo n.º 1
0
 public void GetIllestPerson()
 {
     Console.WriteLine("Anställd som har varit sjuk flest antal gånger: ");
     CronusReference.DataTuple data = cronusClient.GetIllestPerson();
     Console.WriteLine(ConversionUtility.ToString(data));
     ExitQuestion();
 }
Exemplo n.º 2
0
        private static List <List <string> > ExtractData(CronusReference.DataTuple[] values)
        {
            bool isFirst = true;
            List <List <string> > totals = new List <List <string> >();

            for (int i = 0; i < values.Length; i++)
            {
                CronusReference.DataTuple t = values[i];

                List <string> array2   = new List <string>();
                List <string> columns2 = new List <string>();

                //string[] array = new string[t.Count];
                //string[] columns = new string[t.Count];

                if (isFirst)
                {
                    totals.Add(columns2);
                    isFirst = false;
                }
                for (int j = 0; j < t.Count; j++)
                {
                    SerializableKeyValuePairOfStringString s = t.ElementAt(j);
                    columns2.Add(s.Key);
                    array2.Add(s.Value);
                }
                totals.Add(array2);
            }
            return(totals);
        }
        public static string ToString(DataTuple[] tuples)
        {
            int[] longestColumnLength = null;

            bool isFirst = true;
            List <List <string> > totals = new List <List <string> >();

            for (int i = 0; i < tuples.Length; i++)
            {
                CronusReference.DataTuple t = tuples[i];

                if (longestColumnLength == null)
                {
                    longestColumnLength = new int[t.Count];
                }

                List <string> array   = new List <string>();
                List <string> columns = new List <string>();

                if (isFirst)
                {
                    totals.Add(columns);
                    isFirst = false;
                }
                for (int j = 0; j < t.Count; j++)
                {
                    SerializableKeyValuePairOfStringString s = t.ElementAt(j);

                    // Figure out max column length
                    if (s.Value != null)
                    {
                        longestColumnLength[j] = Math.Max(s.Value.Length, longestColumnLength[j]);
                    }
                    columns.Add(s.Key);
                    array.Add(s.Value);
                }
                totals.Add(array);
            }

            // Is the column name the longest value in the column?
            for (int i = 0; i < totals[0].Count; i++)
            {
                string column = totals[0][i];
                if (column != null)
                {
                    longestColumnLength[i] = Math.Max(column.Length, longestColumnLength[i]);
                }
            }
            return(GenerateOutputWithColumns(totals, longestColumnLength));
        }
Exemplo n.º 4
0
        public static List <List <string> > GetCronusData(CronusServiceSoapClient cronusClient, int index)
        {
            List <List <string> > stringValues = new List <List <string> >();

            switch (index)
            {
            case 0:
                CronusReference.DataTuple[] values = new CronusReference.DataTuple[] { cronusClient.GetIllestPerson() };
                return(ExtractData(values));

            case 1:
                values = cronusClient.GetIllPersonsByYear(2004, 2005);     //statiskt anrop för 2004 och 2005 som efterfrågas
                return(ExtractData(values));

            case 2:
                values = cronusClient.GetEmployeeAndRelatives();
                return(ExtractData(values));

            case 3:
                values = cronusClient.GetEmployeeData();
                return(ExtractData(values));

            case 4:
                values = cronusClient.GetEmployeeAbsenceData();
                return(ExtractData(values));

            case 5:
                values = cronusClient.GetEmployeeRelativeData();
                return(ExtractData(values));

            case 6:
                values = cronusClient.GetEmployeeQualificationData();
                return(ExtractData(values));

            case 7:
                values = cronusClient.GetEmployeePortalSetupData();
                return(ExtractData(values));

            case 8:
                values = cronusClient.GetEmployeeStatisticsGroupData();
                return(ExtractData(values));
            }
            return(null);
        }