Beispiel #1
0
        public void runService(string wsdlKey, Dictionary <String, String> args)
        {
            switch (wsdlKey)
            {
            case "ChannelAdvisor.Admin":
                //AdminService admin = new AdminService ("ac93793a-4b71-44d4-ad4d-d302c39c238c","Domo123!");
                APICredentials creds = new APICredentials()
                {
                    DeveloperKey = "ac93793a-4b71-44d4-ad4d-d302c39c238c",
                    Password     = "******"
                };
                //AdminService admin = AdminService.getInstance ("ac93793a-4b71-44d4-ad4d-d302c39c238c", "Domo123!");
                AdminService admin = AdminService.getInstance(args.get("developerKey"), args.get("developerPassword"));
                admin.APICredentialsValue = creds;
                var result = admin.GetAuthorizationList(args.get("localId")).ResultData;

                foreach (AuthorizationResponse resp in result)
                {
                    Console.WriteLine(resp.AccountID + ":" + resp.LocalID);
                }
                break;

            case "CelsiusToFarenheit":
                TempConvert converter = new TempConvert();
                Console.WriteLine(converter.CelsiusToFahrenheit(args.get("temperature")));
                break;

            case "FarenheitToCelsius":
                TempConvert converter2 = new TempConvert();
                Console.WriteLine(converter2.FahrenheitToCelsius(args.get("temperature")));
                break;

            default: throw new Exception("MagicException:Domo encountered error running service:Unable to map SOAP wsdl");
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            // Tasks 1-4

            Class1 function = new Class1();

            Console.WriteLine("Input a whole number to be divided by two.");
            int int1 = Convert.ToInt32(Console.ReadLine());

            function.divTwo(int1, out int result);

            // Task 5

            Console.WriteLine("Input the length of the sides of a square to find the area.");
            int side = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(function.Area(side) + " is the area of this square.");

            Console.WriteLine("Input the length of a rectangle");
            int length = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Now input the width of the same rectangle");
            int width = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(function.Area(length, width) + " is the area of this rectangle.");

            // Task 6

            Console.WriteLine("Input a temperature to be converted from deg F to deg C");
            string fahrenheit = Console.ReadLine();

            Console.WriteLine(fahrenheit + " degrees F is " + TempConvert.FahrenheitToCelsius(fahrenheit) + " degrees Celsius.");
            Console.ReadLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            DirectoryInfo flList = new DirectoryInfo("e:\\");

            FileInfo[] files = flList.GetFiles();
            Console.WriteLine(files[0].GetHashCode());

            Console.WriteLine();

            byte[] byteData = new byte[200];
            char[] charData = new char[200];
            try
            {
                FileStream afile = new FileStream("e:\\test\\try.txt", FileMode.Open);
                using (StreamReader sr = new StreamReader(afile)) {
                    string line = sr.ReadLine();

                    while (line != null)
                    {
                        //Console.WriteLine(line);
                        line = sr.ReadLine();
                    }
                }
            } catch (IOException e) {
                Console.WriteLine("An I/O Exception has been thrown:");
                Console.WriteLine(e.ToString());
                Console.ReadKey();
                return;
            } catch (UnauthorizedAccessException e)
            {
                Console.WriteLine("An I/O Unauthorized has been thrown:");
                Console.WriteLine(e.ToString());
                Console.ReadKey();
                return;
            }

            TempConvert ws         = new TempConvert();
            string      celcius    = ws.FahrenheitToCelsius("100");
            string      fahrenheit = ws.CelsiusToFahrenheit("40");

            Console.WriteLine($"100 deg F = {celcius.ToString()} deg C");
            Console.WriteLine($"40 deg C = {fahrenheit.ToString()} deg F");
            Console.ReadKey();
        }