forked from mhamzap10/Travelling-SalesMan-Problem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeliveryBoy.cs
50 lines (49 loc) · 1.23 KB
/
DeliveryBoy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Travelling_SalesMan_Problem
{
class DeliveryBoy
{
string Name;
string Email;
int id;
public DeliveryBoy()
{
this.id = 0;
this.Name = null;
this.Email = null;
}
public DeliveryBoy(int id, string Name, string Email)
{
this.id = id;
this.Name = Name;
this.Email = Email;
}
public string getName()
{
return this.Name;
}
public string getEmail()
{
return this.Email;
}
public DeliveryBoy GetData(int id)
{
StreamReader reader = new StreamReader(@"DeliveryBoy.csv");
while(!reader.EndOfStream)
{
string list = reader.ReadLine();
string[] values = list.Split(',');
if(id == int.Parse(values[0]))
{
return new DeliveryBoy(int.Parse(values[0]), values[1].ToString(), values[2].ToString());
}
}
return null;
}
}
}