-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbime.cs
More file actions
80 lines (71 loc) · 2.08 KB
/
bime.cs
File metadata and controls
80 lines (71 loc) · 2.08 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;
using System.Collections.Generic;
namespace Ap_Project_Clinic_
{
class bime : IBime
{
public string name { get; set; }
public string familyname { get; set; }
public string id { get; set; }
public double percent { get; set; }
public bime(string name,string familyname,string id,double percent)
{
this.name = name;
this.familyname = familyname;
this.id = id;
this.percent = percent;
}
}
static class readandwritebime
{
static List<bime> allbime = new List<bime>();
static List<IBime> allibime = new List<IBime>();
static string path = rateform.getpath() + "\\bime.txt";
public static List<bime> set()
{
allbime.Clear();
allibime.Clear();
try
{
string[] allbim = System.IO.File.ReadAllLines(path);
string[] bime;
for (int i = 0; i < allbim.Length; i++)
{
bime = allbim[i].Split('*');
allbime.Add(new bime(bime[0], bime[1], bime[2],Convert.ToDouble(bime[3])));
}
return allbime;
}
catch
{
return allbime;
}
}
public static void writeone(bime bime)
{
string save = bime.name + '*' + bime.familyname + '*' + bime.id + '*' + bime.percent+"\n";
System.IO.File.AppendAllText(path, save);
}
public static bime search(string id)
{
set();
for (int i = 0; i < allbime.Count; i++)
{
if(allbime[i].id==id)
{
return allbime[i];
}
}
return null;
}
public static List<IBime>get()
{
set();
for (int i = 0; i < allbime.Count; i++)
{
allibime.Add(allbime[i]);
}
return allibime;
}
}
}