private void ImportSchedule_Click(object sender, EventArgs e) { Classes.Enabled = false; Subjects.Enabled = false; listViewInfo = ListViewInfo.Schedule; if (openFileDialog.ShowDialog() == DialogResult.OK) { StudentServices service = new StudentServices(); var Data = service.GetDataFromFile(openFileDialog.FileName); _Id.Text = "Subject ID"; _Id.Width = 220; _Name.Text = "Subject name"; _Name.Width = 440; _Info1.Text = "Room"; _Info1.Width = 220; listView.Items.Clear(); listView.Columns.Clear(); listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { _No, _Id, _Name, _Info1 }); NotiLabel.Text = $"Press 'Import' button to import the schedule below to class '{Data[0].Id}'."; currClass = Data[0].Id; Data.RemoveAt(0); BindDataToListView(Data); listView.View = View.Details; FileData = Data; ImportButton.Enabled = true; EditButton.Enabled = false; } }
private void ImportScore_Click(object sender, EventArgs e) { Classes.Enabled = false; Subjects.Enabled = false; listViewInfo = ListViewInfo.Scoreboard; if (openFileDialog.ShowDialog() == DialogResult.OK) { StudentServices service = new StudentServices(); var Data = service.GetDataFromFile(openFileDialog.FileName); _Id.Text = "Student ID"; _Id.Width = 170; _Name.Text = "Student name"; _Name.Width = 210; _Info1.Text = "Mid-term score"; _Info1.Width = 125; _Info2.Text = "Final-term score"; _Info2.Width = 125; _Info3.Text = "Other score"; _Info3.Width = 125; _Info4.Text = "Final score"; _Info4.Width = 125; listView.Items.Clear(); listView.Columns.Clear(); listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { _No, _Id, _Name, _Info1, _Info2, _Info3, _Info4 }); NotiLabel.Text = $"Press 'Import' button to import the '{Data[0].Name}' scoreboard below for class '{Data[0].Id}'."; currClass = Data[0].Id; currSubject = Data[0].Name; Data.RemoveAt(0); BindDataToListView(Data); listView.View = View.Details; FileData = Data; ImportButton.Enabled = true; EditButton.Enabled = false; } }
private void ImportClass_Click(object sender, EventArgs e) { Classes.Enabled = false; Subjects.Enabled = false; listViewInfo = ListViewInfo.Students; if (openFileDialog.ShowDialog() == DialogResult.OK) { _Id.Text = "Student ID"; _Id.Width = 170; _Name.Text = "Student name"; _Name.Width = 200; _Info1.Text = "Gender"; _Info1.Width = 170; _Info2.Text = "Identify Card No."; _Info2.Width = 170; _Info3.Text = "Date of Birth"; _Info3.Width = 170; listView.Items.Clear(); listView.Columns.Clear(); listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { _No, _Id, _Name, _Info1, _Info2, _Info3 }); StudentServices service = new StudentServices(); var Data = service.GetDataFromFile(openFileDialog.FileName); NotiLabel.Text = $"Press 'Import' button to import these students below to class '{Data[0].Id}'."; currClass = Data[0].Id; Data.RemoveAt(0); BindDataToListView(Data); listView.View = View.Details; FileData = Data; ImportButton.Enabled = true; EditButton.Enabled = false; } }