Setup and forms
This commit is contained in:
1 parent
aed55f44f9
commit
eee7548fc8
47 files changed
+2837
-8138
No files matched your search
@@ -0,0 +1,94 @@
|
||||
using PaymentLogs.Domain;
|
||||
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 PaymentLogs.Forms
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Form2_Load(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.Columns.Add("id", "Номер");
|
||||
dataGridView1.Columns.Add("name", "Наименование");
|
||||
dataGridView1.Columns.Add("type", "Тип");
|
||||
dataGridView1.Columns.Add("cost", "Цена");
|
||||
dataGridView1.Columns.Add("duration", "Длительность");
|
||||
dataGridView1.Columns.Add("studentsCount", "Кол-во студентов");
|
||||
foreach (Course course in Program.CourseRepository.All())
|
||||
{
|
||||
dataGridView1.Rows.Add(course.Id.ToString(), course.Name.ToString(), course.Type.ToString(), course.Cost.ToString(),
|
||||
course.Duration.ToString(), course.StudentsCount.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void textBox2_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
String text = textBox2.Text;
|
||||
this.Hide();
|
||||
new StudentsForm(text).Show();
|
||||
}
|
||||
|
||||
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow row in dataGridView1.Rows)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (row.Cells.Count > 1 && row.Cells["id"].Value != null)
|
||||
{
|
||||
Course course = new Course
|
||||
{
|
||||
Id = Convert.ToInt32(row.Cells["id"].Value),
|
||||
Name = row.Cells["name"].Value.ToString(),
|
||||
Type = row.Cells["type"].Value.ToString(),
|
||||
Cost = Convert.ToInt32(row.Cells["cost"].Value),
|
||||
Duration = Convert.ToInt32(row.Cells["duration"].Value),
|
||||
StudentsCount = Convert.ToInt32(row.Cells["studentsCount"].Value)
|
||||
};
|
||||
Program.CourseRepository.Update(course.Id, course);
|
||||
}
|
||||
|
||||
}
|
||||
catch (NullReferenceException ignored)
|
||||
{
|
||||
Console.WriteLine(ignored.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
Program.CourseRepository.Save();
|
||||
}
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
new MainForm().Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user