-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDelete.cs
91 lines (79 loc) · 2.35 KB
/
Delete.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
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
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ProofConceptFinalProj
{
public partial class Delete : Form
{
ClsEmployee[] Data = new ClsEmployee[200];
SubClsTxtFileIO objSubClsTxtFileIO = new SubClsTxtFileIO();
int location = 0;
int totalNum = 0;
public Delete()
{
InitializeComponent();
for (int i = 0; i < Data.Length; i++)
{
Data[i] = new ClsEmployee();
}
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Delete_Load(object sender, EventArgs e)
{
objSubClsTxtFileIO.PopulateEmployees(Data);
foreach(ClsEmployee test in Data)
{
if(test.EmployeeFName != "")
{
totalNum++;
}
}
displayInfo();
}
private void displayInfo()
{
label1.Text = Data[location].EmployeeFName;
}
private void button1_Click(object sender, EventArgs e)
{
location++;
if (location == totalNum)
{
location = 0;
displayInfo();
} else
{
displayInfo();
}
}
private void button2_Click(object sender, EventArgs e)
{
Data[location] = new ClsEmployee();
if (location != 2)
{
for (int i = location; i <= totalNum - 1; i++)
{
Data[i] = Data[i + 1];
}
} else
{
location = -1;
}
totalNum--;
ClsTxtFileIO objFile = new ClsTxtFileIO();
objFile.CreateFile();
for(int i = 0; i <= totalNum - 1;i++)
{
objFile.AppendRecords(Data[i].EmployeeFName, Data[i].EmployeeLName, Data[i].Department, Data[i].PhoneNumber, Data[i].AnnualSalary, Data[i].VacationDaysEarned);
}
}
}
}