-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddRow.cs
More file actions
34 lines (32 loc) · 1.13 KB
/
AddRow.cs
File metadata and controls
34 lines (32 loc) · 1.13 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
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 DataBaseLab1_2
{
public partial class AddRow : Form
{
private DMS dms;
public AddRow(DMS dMS)
{
dms = dMS;
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
string name = txtName.Text, surname = txtSurname.Text, patronymic = txtPatronymic.Text;
int countSames = 0;
for (int i = 0; i < dms.studentsData.Count; ++i)
if (dms.studentsData[i][1] == name && (dms.studentsData[i][2] == surname || dms.studentsData[i][2] == surname + countSames.ToString()) && dms.studentsData[i][3] == patronymic)
++countSames;
dms.studentsData.Add(new List<string>() { dms.countStId.ToString(), name, surname + ((countSames == 0) ? ("") : (countSames.ToString())), patronymic });
++dms.countStId;
this.Close();
}
}
}