예제 #1
0
 private static void ListEval(IEvalService client)
 {
     Console.WriteLine();
     foreach (var item in client.GetAllEvals())
     {
         Console.WriteLine($"{item.Comments} {item.Submitter} {item.Timesent}");
     }
     Console.ReadKey();
 }
예제 #2
0
        private static void GetEval(IEvalService client)
        {
            Console.WriteLine();
            Console.Write("ID: ");
            var inp = Console.ReadLine();

            Console.WriteLine(client.GetEval(inp));
            Console.ReadKey();
        }
예제 #3
0
        private static void RemoveEval(IEvalService client)
        {
            Console.WriteLine();
            Console.Write("ID: ");
            var inp = Console.ReadLine();

            client.RemoveEval(inp);
            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            WebChannelFactory <IEvalService> cf = new WebChannelFactory <IEvalService>(new Uri("http://localhost:8089/evalservice"));

            IEvalService client = cf.CreateChannel();



            string input = "";

            while (input != "exit")
            {
                Console.Clear();
                Console.WriteLine("exit: quit app");
                Console.WriteLine("submit: submit eval");
                Console.WriteLine("get: get eval");
                Console.WriteLine("list: list evals");
                Console.WriteLine("remove: remove eval");
                Console.WriteLine();
                Console.Write("> ");
                input = Console.ReadLine();


                switch (input.ToLower())
                {
                case "exit":
                    return;

                case "submit":
                    SubmitEval(client);
                    break;

                case "get":
                    GetEval(client);
                    break;

                case "list":
                    ListEval(client);
                    break;

                case "remove":
                    RemoveEval(client);
                    break;

                default:
                    break;
                }
            }
        }
예제 #5
0
        private static void SubmitEval(IEvalService client)
        {
            Console.WriteLine();
            Console.Write("Submitter: ");
            var submitter = Console.ReadLine();

            Console.Write("Comments: ");
            var comments = Console.ReadLine();

            var eval = new Eval {
                Submitter = submitter, Comments = comments, Timesent = DateTime.Now
            };

            client.SubmitEval(eval);
        }
예제 #6
0
        static void Main(string[] args)
        {
            var factory = new ChannelFactory <IEvalService>("http");

            IEvalService channel = factory.CreateChannel();
            var          eval    = new Eval()
            {
                Comment = "Hallå ja", Submitter = "Dallas", TimeSent = DateTime.Now
            };

            channel.SubmitEval(eval);

            Console.WriteLine("Success!");
            var doneEval = channel.GetEvals();

            foreach (var e in doneEval)
            {
                Console.WriteLine($"{e.Submitter} {e.TimeSent}");
                Console.WriteLine($"{e.Comment}");
                Console.WriteLine("--------------------------");
            }
            Console.ReadKey();
            factory.Close();
        }
예제 #7
0
파일: main.cs 프로젝트: staherianYMCA/test
        static void Main(string[] args)
        {
            try
            {
                IPHostEntry
                    ips = Dns.GetHostEntry(Dns.GetHostName());

                IPAddress
                    _ipAddress = ips.AddressList[0];

                string
                    endPointAddr = "net.tcp://" + _ipAddress.ToString() + ":8000/EvalService";

                NetTcpBinding
                    tcpBinding = new NetTcpBinding();

                tcpBinding.TransactionFlow = false;
                tcpBinding.Security.Transport.ProtectionLevel      = System.Net.Security.ProtectionLevel.EncryptAndSign;
                tcpBinding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
                tcpBinding.Security.Mode = SecurityMode.None;

                EndpointAddress
                    endpointAddress = new EndpointAddress(endPointAddr);

                Console.WriteLine("Attempt to connect to: " + endPointAddr);

                IEvalService
                    proxy = ChannelFactory <IEvalService> .CreateChannel(tcpBinding, endpointAddress);

                using (proxy as IDisposable)
                {
                    Eval
                        eval;

                    eval = new Eval {
                        Comments = "CommentsField1", Submitter = "Submitter1", TimeSubmitted = DateTime.Now
                    };
                    proxy.SubmitEval(eval);
                    eval = new Eval {
                        Comments = "CommentsField2", Submitter = "Submitter2", TimeSubmitted = DateTime.Now
                    };
                    proxy.SubmitEval(eval);
                    eval = new Eval {
                        Comments = "CommentsField3", Submitter = "Submitter3", TimeSubmitted = DateTime.Now
                    };
                    proxy.SubmitEval(eval);

                    Eval[]
                    evals = proxy.GetEvals();

                    foreach (Eval e in evals)
                    {
                        Console.WriteLine("{0}\t{1}\t{2}", e.Id, e.Submitter, e.TimeSubmitted);
                    }
                }
            }
            catch (Exception eException)
            {
                Console.WriteLine("{1}{0}Message: \"{2}\"{3}{0}StackTrace:{0}{4}",
                                  Environment.NewLine,
                                  eException.GetType().FullName,
                                  eException.Message,
                                  eException.InnerException != null ? Environment.NewLine + "InnerException.Message: \"" + eException.InnerException.Message + "\"" : string.Empty,
                                  eException.StackTrace);
            }

            Console.ReadLine();
        }
예제 #8
0
 public EvalModule(IEvalService evalService)
 {
     _evalService = evalService;
 }
예제 #9
0
        static void Main(string[] args)
        {
            WebChannelFactory <IEvalService> cf = new WebChannelFactory <IEvalService>(
                new Uri("http://localhost:8080/EvalService"));
            IEvalService client = cf.CreateChannel();

            Console.WriteLine("Please enter one of following commands.");
            Console.WriteLine("submit");
            Console.WriteLine("get");
            Console.WriteLine("list");
            Console.WriteLine("remove");
            Console.WriteLine("exit");


            var command = Console.ReadLine();

            while (command != "Exit")
            {
                switch (command)
                {
                case "submit":
                    Console.WriteLine("Enter comment");
                    var comment = Console.ReadLine();
                    Console.WriteLine("Enter Submitter");
                    var submitter = Console.ReadLine();
                    var eval      = new Eval()
                    {
                        Comment   = comment,
                        Submitter = submitter,
                        TimeSent  = DateTime.Now
                    };

                    client.SubmitEval(eval);
                    Console.WriteLine("eval submitted");
                    command = null;
                    break;

                case "get":
                    Console.WriteLine("Enter a Eval ID:");
                    var evalId     = Console.ReadLine();
                    var gottenEval = client.GetEval(evalId);

                    Console.WriteLine((gottenEval != null) ? $" {gottenEval.Id}. {gottenEval.Submitter} said { gottenEval.Comment }" : "No Eval found");
                    Console.ReadLine();
                    command = null;

                    break;

                case "list":
                    Console.WriteLine("Enter name of submitter");
                    var submitterName = Console.ReadLine();
                    //if (!string.IsNullOrWhiteSpace(submitterName))
                    //{

                    var evalsBySubmitter = client.GetEvalBySubmitter(submitterName);
                    if (evalsBySubmitter != null)
                    {
                        evalsBySubmitter.ForEach(e => Console.WriteLine($" {e.Id}. {e.Submitter} said { e.Comment }"));
                    }
                    else
                    {
                        Console.WriteLine("No Evals found by {0}", submitterName);
                    }
                    //}
                    //else
                    //{
                    //    Console.WriteLine("Invalid input!");
                    //}
                    Console.ReadLine();
                    command = null;
                    break;

                case "remove":
                    Console.WriteLine("Enter Id to remove Eval");
                    var idToRemove = Console.ReadLine();
                    client.RemoveEval(idToRemove);

                    break;

                case "exit":
                    Environment.Exit(-1);
                    break;
                }
                Console.Clear();

                Console.WriteLine("Please enter one of following commands.");
                Console.WriteLine("submit");
                Console.WriteLine("get");
                Console.WriteLine("list");
                Console.WriteLine("remove");
                Console.WriteLine("exit");


                command = Console.ReadLine();
            }
        }
예제 #10
0
        static void Main(string[] args)
        {
            WebChannelFactory <IEvalService> cf = new WebChannelFactory <IEvalService>(
                new Uri("http://localhost:8089/evalservice"));

            IEvalService client = cf.CreateChannel();

            while (true)
            {
                Console.WriteLine("[submit]");
                Console.WriteLine("[get]");
                Console.WriteLine("[list]");
                Console.WriteLine("[remove]");
                Console.WriteLine("[exit]");
                Console.WriteLine("Enter a commando >> ");
                string comm = Console.ReadLine();

                switch (comm)
                {
                case "submit":
                    // getting all the required fields for the new eval to create
                    Console.WriteLine("Who is the subbmitter? >> ");
                    string submter = Console.ReadLine();

                    Console.WriteLine("enter comments in one string >> ");
                    string comments = Console.ReadLine();

                    Console.WriteLine("Enter an unique id for the EVAL >> ");
                    string id = Console.ReadLine();

                    // creating the EVAL
                    Eval e = new Eval()
                    {
                        Comments  = comments,
                        Submitter = submter,
                        TimeSent  = DateTime.Now,
                        Id        = id,
                    };

                    // subbmitting the new eval
                    client.SubmitEval(e);

                    Console.WriteLine("Created!");

                    break;

                case "get":
                    Console.WriteLine("enter a id");
                    string input = Console.ReadLine();

                    Eval retrieved = client.GetEval(input);
                    if (retrieved != null)
                    {
                        Console.WriteLine("Entered: ");
                        Console.WriteLine(retrieved.Comments + ' ' + retrieved.Submitter);
                    }
                    else
                    {
                        Console.WriteLine("No Eval matching id: " + input);
                    }
                    break;

                case "list":
                    Console.WriteLine("Enter a subbmitter >>");
                    string submitterInput = Console.ReadLine();

                    List <Eval> retrievedEvals = client.GetEvalsBySybmitter(submitterInput);

                    if (retrievedEvals.Count != 0 || retrievedEvals == null)
                    {
                        foreach (var ev in retrievedEvals)
                        {
                            Console.WriteLine(ev.Submitter + " " + ev.Comments);
                            Console.WriteLine("------------");
                        }
                    }

                    break;

                case "remove":
                    Console.WriteLine("Id to remove >> ");
                    string removeId = Console.ReadLine();
                    client.RemoveEval(removeId);
                    break;

                default:
                    Console.WriteLine("Command is not supported!");
                    break;
                }
                if (comm == "exit")
                {
                    break;
                }
                Console.ReadKey();
            }

            Console.WriteLine("exiting program");
        }
예제 #11
0
 public ItemController(IPermissionService permissionService, IItemService itemService, IEvalService evalService)
 {
     _permissionService = permissionService;
     _itemService       = itemService;
     _evalService       = evalService;
 }
예제 #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("*** Evaluation Client Application ***\n");

            //EvalServiceClient client =
            //    new EvalServiceClient("BasicHttpBinding_IEvalService");

            WebChannelFactory <IEvalService> cf =
                new WebChannelFactory <IEvalService>(
                    new Uri("http://localhost:8080/evalservice"));
            IEvalService client = cf.CreateChannel();

            Console.WriteLine("Please enter a command: ");
            string command = Console.ReadLine();

            while (!command.Equals("exit"))
            {
                switch (command)
                {
                case "submit":

                    Console.WriteLine("Please enter your name:");
                    string name = Console.ReadLine();
                    Console.WriteLine("Please enter your comments:");
                    string comments = Console.ReadLine();

                    Eval eval = new Eval();
                    eval.Timesent  = DateTime.Now;
                    eval.Submitter = name;
                    eval.Comments  = comments;

                    client.SubmitEval(eval);

                    Console.WriteLine("Evaluation submitted!\n");
                    break;

                case "get":
                    Console.WriteLine("Please enter the eval id:");
                    string id = Console.ReadLine();

                    Eval fe = client.GetEval(id);
                    Console.WriteLine("{0} -- {1} said: {2} (id {3})\n", fe.Timesent, fe.Submitter, fe.Comments, fe.Id);
                    break;

                case "list":

                    Console.WriteLine("Please enter the submitter name:");
                    name = Console.ReadLine();

                    List <Eval> evals = client.GetEvalsBySubmitter(name);

                    evals.ForEach(e => Console.WriteLine("{0} -- {1} said: {2} (id {3})", e.Timesent, e.Submitter, e.Comments, e.Id));
                    Console.WriteLine();
                    break;

                case "remove":

                    Console.WriteLine("Please enter the eval id:");
                    id = Console.ReadLine();

                    client.RemoveEval(id);

                    Console.WriteLine("Evaluation {0} removed!\n", id);
                    break;

                default:
                    Console.WriteLine("Unsupported command.");
                    break;
                }

                Console.WriteLine("Please enter a command: ");
                command = Console.ReadLine();
            }
        }
예제 #13
0
 public static void setUp(IEvalService service)
 {
     impl = service;
 }