Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- using System.IO;
- namespace kurs
- {
- public partial class Form6 : Form
- {
- public Form6()
- {
- InitializeComponent();
- }
- string path_cli = @"clients.txt";
- string path_work = @"work.txt";
- int[] stud_hhd = new int[0];
- string[] stud = new string[0];
- string[] stud_cab = new string[0];
- string[] stud_cab_counter = new string[0];
- int[] stud_counter = new int[0];
- int[] stud_h_counter = new int[0];
- string[] stud_work = new string[0];
- int[] hrs = new int[0];
- int rk = 0;
- int rk1 = 0;
- int rk2 = 1;
- int nn = 0;
- int hr = 0;
- private void Form6_Load(object sender, EventArgs e)
- {
- dataGridView1.Columns.Add("Kod", "Код");
- dataGridView1.Columns.Add("Stud", "Фамилия студента");
- dataGridView1.Columns.Add("kabs", "Количество посещенных кабинетов");
- dataGridView1.Columns.Add("hrs", "Общее кол-во часов");
- dataGridView1.Columns.Add("exs", "Посещал кабинеты");
- using (StreamReader sr = new StreamReader(path_cli, Encoding.GetEncoding(1251)))
- {
- string line;
- while ((line = sr.ReadLine()) != null)
- {
- string[] split = line.Split(';');
- Array.Resize(ref stud, stud.Length + 1);
- stud[rk] = split[1];
- Array.Resize(ref stud_counter, stud_counter.Length + 1);
- stud_counter[rk] = 0;
- Array.Resize(ref stud_h_counter, stud_h_counter.Length + 1);
- stud_h_counter[rk] = 0;
- Array.Resize(ref stud_cab_counter, stud_cab_counter.Length + 1);
- stud_cab_counter[rk] = "";
- rk++;
- }
- }
- using (StreamReader sr = new StreamReader(path_work, Encoding.GetEncoding(1251)))
- {
- string line;
- while ((line = sr.ReadLine()) != null)
- {
- string[] split = line.Split(';');
- Array.Resize(ref stud_hhd, stud_hhd.Length + 1);
- stud_hhd[rk1] = Int32.Parse(split[5]);
- Array.Resize(ref stud_work, stud_work.Length + 1);
- stud_work[rk1] = split[2];
- Array.Resize(ref stud_cab, stud_cab.Length + 1);
- stud_cab[rk1] = split[4];
- rk1++;
- }
- }
- }
- private void Form6_FormClosing(object sender, FormClosingEventArgs e)
- {
- e.Cancel = true;
- Hide();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < stud_work.Length; i++)
- {
- if (stud.Contains(stud_work[i]))
- {
- stud_counter[Array.IndexOf(stud, stud_work[i])]++;
- stud_h_counter[Array.IndexOf(stud, stud_work[i])]+=stud_hhd[i];
- stud_cab_counter[Array.IndexOf(stud, stud_work[i])] += stud_cab[i] + ",";
- }
- }
- for (int i = 0; i < stud.Length; i++)
- {
- dataGridView1.Rows.Add(i, stud[i], stud_counter[i], stud_h_counter[i], stud_cab_counter[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement