Advertisement
Guest User

Untitled

a guest
May 12th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Runtime.Remoting.Channels;
  10. using System.Runtime.Remoting.Channels.Tcp;
  11. using System.Windows.Forms;
  12.  
  13. namespace ConsoleClient
  14. {
  15.     class MyClient
  16.     {
  17.  
  18.         static void Main(string[] args)
  19.         {
  20.  
  21.             TcpChannel tcpChannel = new TcpChannel();
  22.             ChannelServices.RegisterChannel(tcpChannel, true);
  23.             GradeCalculate remoteObject = (GradeCalculate)Activator.GetObject(typeof(GradeCalculate), "tcp://localhost:9998/gradecalculator");
  24.  
  25.  
  26.             string username, password;
  27.             int totalModules;
  28.             int[] marks = new int[31];
  29.             String EvaluatorResults;
  30.  
  31.  
  32.  
  33.             System.Console.WriteLine("please enter your Username");
  34.             username = Console.ReadLine();
  35.             System.Console.WriteLine("Please enter your password");
  36.             password = Console.ReadLine();
  37.  
  38.             bool authenticated = remoteObject.authenticate(username, password);
  39.             Console.Clear();
  40.  
  41.             if (authenticated)
  42.             {
  43.  
  44.                 System.Console.WriteLine("Enter total number modules (atleast 12 and max 30)");
  45.                 totalModules = Convert.ToInt32(Console.ReadLine());
  46.  
  47.  
  48.                 if (totalModules >= 12 && totalModules <= 30)
  49.                 {
  50.  
  51.                     //int i = totalNoModules;
  52.  
  53.                     for (int i = 1; i <= totalModules; i++)
  54.                     {
  55.  
  56.                         Console.WriteLine("Enter marks for Module " + i);
  57.                         marks[i] = Convert.ToInt32(Console.ReadLine());
  58.                         //Console.WriteLine("you have entereed " + marks[i]);
  59.                     }
  60.                 }
  61.                 EvaluatorResults = remoteObject.Evaluator(username, marks, totalModules);
  62.  
  63.                 System.Console.WriteLine(EvaluatorResults);
  64.  
  65.  
  66.             }
  67.  
  68.  
  69.  
  70.         }
  71.  
  72.  
  73.  
  74.  
  75.     }
  76.  
  77.     public partial class Form1 : Form
  78.     {
  79.         public Form1()
  80.         {
  81.             InitializeComponent();
  82.         }
  83.  
  84.         private void textBox3_TextChanged(object sender, EventArgs e)
  85.         {
  86.  
  87.         }
  88.  
  89.         private void Form1_Load(object sender, EventArgs e)
  90.         {
  91.  
  92.         }
  93.  
  94.         private void label1_Click(object sender, EventArgs e)
  95.         {
  96.            
  97.         }
  98.  
  99.         private void textBox1_TextChanged(object sender, EventArgs e)
  100.         {
  101.  
  102.         }
  103.  
  104.         private void label1_Click_1(object sender, EventArgs e)
  105.         {
  106.  
  107.         }
  108.  
  109.         private void textBox18_TextChanged(object sender, EventArgs e)
  110.         {
  111.  
  112.         }
  113.     }
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement