Advertisement
Guest User

client

a guest
May 5th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Remoting.Channels;
  5. using System.Runtime.Remoting.Channels.Tcp;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9.  
  10. namespace ConsoleClient
  11. {
  12.     class MyClient
  13.     {
  14.        
  15.         static void Main(string[] args)
  16.         {
  17.  
  18.             TcpChannel tcpChannel = new TcpChannel();
  19.             ChannelServices.RegisterChannel(tcpChannel, true);
  20.             GradeCalculate remoteObject = (GradeCalculate)Activator.GetObject(typeof(GradeCalculate), "tcp://localhost:9998/gradecalculator");
  21.            
  22.            
  23.             string username, password;
  24.             //bool exit = true;
  25.             int totalModules;
  26.             int[] marks = new int[31];
  27.  
  28.             System.Console.WriteLine("please enter your Username");
  29.             username = Console.ReadLine();
  30.             System.Console.WriteLine("Please enter your password");
  31.             password = Console.ReadLine();
  32.             bool authenticated = remoteObject.authenticate(username, password);
  33.             Console.Clear();
  34.  
  35.             if (authenticated)
  36.             {
  37.  
  38.                 System.Console.WriteLine("Enter total number modules (atleast 12 and max 30)");
  39.                 totalModules = Convert.ToInt32(Console.ReadLine());
  40.  
  41.  
  42.                 if (totalModules >= 12 && totalModules <= 30)
  43.                 {
  44.  
  45.                     //int i = totalNoModules;
  46.                            
  47.                     for (int i = 1; i <= totalModules; i++)
  48.                     {
  49.                                
  50.                         Console.WriteLine("Enter marks for Module " + i);
  51.                         marks[i] = Console.Read();
  52.                         Console.WriteLine("you have entereed " + marks[i]);
  53.                     }
  54.                 }
  55.                
  56.  
  57.                                                
  58.                 for (int i =1; i <= totalModules; i++)
  59.                 {
  60.                     Console.Write("marks ");
  61.                     Console.WriteLine(marks[i]);
  62.                 }
  63.  
  64.  
  65.  
  66.  
  67.  
  68.             }
  69.  
  70.            
  71.             //System.Console.WriteLine(authenticated);
  72.  
  73.         }
  74.  
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement