예제 #1
0
        private void Export_Trainess_Click(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "Файлы excel|*.xlsx";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                List <DataTrainess> listTrainesses = DataTrainess.Select("");
                string[,] values = new string[listTrainesses.Count + 1, 5];

                values[0, 0] = "Класс";
                values[0, 1] = "Фамилия";
                values[0, 2] = "Имя";
                values[0, 3] = "Отчество";

                for (int i = 0; i < listTrainesses.Count; i++)
                {
                    values[i + 1, 0] = listTrainesses[i].Class.ToString();
                    values[i + 1, 1] = listTrainesses[i].Family_name;
                    values[i + 1, 2] = listTrainesses[i].First_name;
                    values[i + 1, 3] = listTrainesses[i].Middle_name;
                }
                ExportData.ExportExcel(dialog.FileName, "Обучающиеся", values);
            }
        }
예제 #2
0
 private void Delete_Trainess_Click(object sender, EventArgs e)
 {
     if (dgv_Trainess.SelectedRows.Count > 0)
     {
         DataTrainess trainess = dgv_Trainess.SelectedRows[0].Tag as DataTrainess;
         trainess.Delete();
         UpdateData_Trainess();
     }
 }
예제 #3
0
 private void UpdateData_Trainess()
 {
     dgv_Trainess.Rows.Clear();
     foreach (DataTrainess listTreiness in DataTrainess.Select(tb_SearchTrainess.Text))
     {
         int r = dgv_Trainess.Rows.Add(listTreiness.Class, listTreiness.Family_name, listTreiness.First_name, listTreiness.Middle_name);
         dgv_Trainess.Rows[r].Tag = listTreiness;
     }
 }
예제 #4
0
 private void Edit_Trainess_Click(object sender, EventArgs e)
 {
     if (dgv_Trainess.SelectedRows.Count > 0)
     {
         DataTrainess trainess = dgv_Trainess.SelectedRows[0].Tag as DataTrainess;
         AddTrainess  f_at     = new AddTrainess(trainess);
         f_at.Show();
         Update();
     }
 }
예제 #5
0
        public AddTrainess(DataTrainess TrainessEdit)
        {
            this.TrainessEdited = TrainessEdit;
            InitializeComponent();


            nud_AddTrainess_class.Value = TrainessEdit.Class;
            tb_AddTrainess_fam.Text     = TrainessEdit.Family_name;
            tb_AddTrainess_name.Text    = TrainessEdit.First_name;
            tb_AddTrainess_middle.Text  = TrainessEdit.Middle_name;
        }
예제 #6
0
 private void Ok_AddTrainess_Click(object sender, EventArgs e)
 {
     if (nud_AddTrainess_class.Value.ToString().Length > 0 && tb_AddTrainess_fam.Text.Length > 0 && tb_AddTrainess_name.Text.Length > 0 && tb_AddTrainess_middle.Text.Length > 0)
     {
         if (TrainessEdited == null)
         {
             DataTrainess.TrainessAdd(Convert.ToInt32(nud_AddTrainess_class.Value), tb_AddTrainess_fam.Text, tb_AddTrainess_name.Text, tb_AddTrainess_middle.Text);
         }
         else
         {
             TrainessEdited.TrainessEdit(Convert.ToInt32(nud_AddTrainess_class.Value), tb_AddTrainess_fam.Text, tb_AddTrainess_name.Text, tb_AddTrainess_middle.Text);
         }
         Close();
     }
     else
     {
         MessageBox.Show("Пожалуйства, заполните все данные!");
     }
 }