Готово 2
This commit is contained in:
parent
ad006f8af0
commit
77fa33ef78
@ -13,6 +13,7 @@ namespace Academic_Performance.Entities
|
||||
public int SubjectId { get; private set; }
|
||||
public int TeacherId{ get; private set; }
|
||||
|
||||
public DateTime Date { get; private set; }
|
||||
public IEnumerable<Mark> Mark{ get; private set; } = [];
|
||||
public static Statement CreateOperation(int id, int subjectId, int teacherId, IEnumerable<Mark> mark)
|
||||
{return new Statement
|
||||
@ -20,7 +21,7 @@ namespace Academic_Performance.Entities
|
||||
Id = id,
|
||||
SubjectId = subjectId,
|
||||
TeacherId = teacherId,
|
||||
|
||||
Date = DateTime.Now,
|
||||
Mark = mark
|
||||
};
|
||||
}
|
||||
|
@ -30,10 +30,8 @@
|
||||
{
|
||||
buttonSave = new Button();
|
||||
buttonEx = new Button();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
dateTimePicker1 = new DateTimePicker();
|
||||
comboBoxType = new ComboBox();
|
||||
textBoxInf = new TextBox();
|
||||
comboBoxIdStudent = new ComboBox();
|
||||
@ -42,10 +40,10 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(64, 310);
|
||||
buttonSave.Location = new Point(130, 259);
|
||||
buttonSave.Margin = new Padding(2);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(90, 27);
|
||||
buttonSave.Size = new Size(127, 27);
|
||||
buttonSave.TabIndex = 1;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -53,57 +51,40 @@
|
||||
//
|
||||
// buttonEx
|
||||
//
|
||||
buttonEx.Location = new Point(458, 323);
|
||||
buttonEx.Location = new Point(367, 259);
|
||||
buttonEx.Margin = new Padding(2);
|
||||
buttonEx.Name = "buttonEx";
|
||||
buttonEx.Size = new Size(90, 27);
|
||||
buttonEx.Size = new Size(115, 27);
|
||||
buttonEx.TabIndex = 2;
|
||||
buttonEx.Text = "Отмена";
|
||||
buttonEx.UseVisualStyleBackColor = true;
|
||||
buttonEx.Click += buttonEx_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(50, 25);
|
||||
label1.Margin = new Padding(2, 0, 2, 0);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(41, 20);
|
||||
label1.TabIndex = 3;
|
||||
label1.Text = "Дата";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(56, 83);
|
||||
label2.Location = new Point(83, 19);
|
||||
label2.Margin = new Padding(2, 0, 2, 0);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(35, 20);
|
||||
label2.TabIndex = 4;
|
||||
label2.Text = "Тип";
|
||||
label2.Click += label2_Click;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(22, 150);
|
||||
label3.Location = new Point(35, 94);
|
||||
label3.Margin = new Padding(2, 0, 2, 0);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(102, 20);
|
||||
label3.TabIndex = 5;
|
||||
label3.Text = "Информация";
|
||||
//
|
||||
// dateTimePicker1
|
||||
//
|
||||
dateTimePicker1.Location = new Point(147, 21);
|
||||
dateTimePicker1.Margin = new Padding(2);
|
||||
dateTimePicker1.Name = "dateTimePicker1";
|
||||
dateTimePicker1.Size = new Size(241, 27);
|
||||
dateTimePicker1.TabIndex = 6;
|
||||
//
|
||||
// comboBoxType
|
||||
//
|
||||
comboBoxType.FormattingEnabled = true;
|
||||
comboBoxType.Location = new Point(147, 83);
|
||||
comboBoxType.Location = new Point(157, 11);
|
||||
comboBoxType.Margin = new Padding(2);
|
||||
comboBoxType.Name = "comboBoxType";
|
||||
comboBoxType.Size = new Size(414, 28);
|
||||
@ -111,7 +92,7 @@
|
||||
//
|
||||
// textBoxInf
|
||||
//
|
||||
textBoxInf.Location = new Point(140, 154);
|
||||
textBoxInf.Location = new Point(157, 87);
|
||||
textBoxInf.Margin = new Padding(2);
|
||||
textBoxInf.Name = "textBoxInf";
|
||||
textBoxInf.Size = new Size(421, 27);
|
||||
@ -120,7 +101,7 @@
|
||||
// comboBoxIdStudent
|
||||
//
|
||||
comboBoxIdStudent.FormattingEnabled = true;
|
||||
comboBoxIdStudent.Location = new Point(140, 214);
|
||||
comboBoxIdStudent.Location = new Point(157, 164);
|
||||
comboBoxIdStudent.Margin = new Padding(2);
|
||||
comboBoxIdStudent.Name = "comboBoxIdStudent";
|
||||
comboBoxIdStudent.Size = new Size(421, 28);
|
||||
@ -129,7 +110,7 @@
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(11, 217);
|
||||
label4.Location = new Point(35, 172);
|
||||
label4.Margin = new Padding(2, 0, 2, 0);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(107, 20);
|
||||
@ -140,15 +121,13 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(640, 360);
|
||||
ClientSize = new Size(640, 308);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(comboBoxIdStudent);
|
||||
Controls.Add(textBoxInf);
|
||||
Controls.Add(comboBoxType);
|
||||
Controls.Add(dateTimePicker1);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonEx);
|
||||
Controls.Add(buttonSave);
|
||||
Margin = new Padding(2);
|
||||
@ -164,10 +143,8 @@
|
||||
|
||||
private Button buttonSave;
|
||||
private Button buttonEx;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePicker1;
|
||||
private ComboBox comboBoxType;
|
||||
private TextBox textBoxInf;
|
||||
private ComboBox comboBoxIdStudent;
|
||||
|
@ -93,5 +93,15 @@ namespace Academic_Performance.Forms
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ namespace Academic_Performance.Forms
|
||||
}
|
||||
textBoxName.Text = student.Name;
|
||||
textBoxFlow.Text = student.Flow;
|
||||
checkedListBoxGroup.SelectedItem =student.Groupp;
|
||||
|
||||
_studentId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -88,10 +88,19 @@ namespace Academic_Performance.Forms
|
||||
}
|
||||
|
||||
}
|
||||
private Student CreateStudent(int id) => Student.CreateEntity(
|
||||
id,
|
||||
textBoxName.Text, textBoxFlow.Text, (Groupp)checkedListBoxGroup.SelectedItem!
|
||||
);
|
||||
private Student CreateStudent(int id)
|
||||
{
|
||||
|
||||
Groupp groupp = Groupp.None;
|
||||
foreach (var elem in checkedListBoxGroup.CheckedItems)
|
||||
{
|
||||
groupp |= (Groupp)elem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Student.CreateEntity(id, textBoxName.Text, textBoxFlow.Text, groupp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
||||
namespace Academic_Performance.Repositories
|
||||
{
|
||||
public interface IOrderRepository
|
||||
{ IEnumerable<Order> ReadOrder();
|
||||
{ IEnumerable<Order> ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null);
|
||||
Order GetOrderById(int id);
|
||||
void AddOrder(Order order);
|
||||
void UpdateOrder(Order order);
|
||||
|
@ -9,7 +9,7 @@ namespace Academic_Performance.Repositories
|
||||
{
|
||||
public interface IStatementRepository
|
||||
{
|
||||
IEnumerable<Statement> ReadStatement();
|
||||
IEnumerable<Statement> ReadStatement(DateTime? dateForm = null, DateTime? dateTo = null);
|
||||
void CreateStatement(Statement statement);
|
||||
void DeleteStatement(int id);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"INSERT INTO Orderr(TypeS,Date,StudentId,Information)
|
||||
var queryInsert = @"INSERT INTO Orderrr(TypeS,Date,StudentId,Information)
|
||||
VALUES (@TypeS,@Date,@StudentId,@Information)";
|
||||
connection.Execute(queryInsert, order);
|
||||
}
|
||||
@ -46,7 +46,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM Orderr WHERE Id=@id";
|
||||
var queryDelete = @"DELETE FROM Orderrr WHERE Id=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -66,7 +66,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Orderr WHERE Id=@id";
|
||||
var querySelect = @"SELECT * FROM Orderrr WHERE Id=@id";
|
||||
var order = connection.QueryFirst<Order>(querySelect, new
|
||||
{
|
||||
id
|
||||
@ -90,7 +90,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryUpdate = @"UPDATE Orderr SET
|
||||
var queryUpdate = @"UPDATE Orderrr SET
|
||||
Information=@Information,
|
||||
TypeS=@TypeS,
|
||||
Date=@Date,
|
||||
@ -104,13 +104,13 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
throw;
|
||||
}
|
||||
}
|
||||
IEnumerable<Order> IOrderRepository.ReadOrder()
|
||||
IEnumerable<Order> IOrderRepository.ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Orderr";
|
||||
var querySelect = "SELECT * FROM Orderrr";
|
||||
var order = connection.Query<Order>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(order));
|
||||
|
@ -30,9 +30,9 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
connection.Open();
|
||||
using var transaction = connection.BeginTransaction();
|
||||
var queryInsert = @"INSERT INTO Statemant (TeacherId,SubjectId)
|
||||
VALUES (@TeacherId, @SubjectId);
|
||||
SELECT MAX(Id) FROM Statemant";
|
||||
var queryInsert = @"INSERT INTO Statement11 (TeacherId,SubjectId,Date)
|
||||
VALUES (@TeacherId, @SubjectId,@Date);
|
||||
SELECT MAX(Id) FROM Statement11";
|
||||
var statementId = connection.QueryFirst<int>(queryInsert, statement, transaction);
|
||||
var querySubInsert = @"INSERT INTO Markkk(Value,StudentId)
|
||||
VALUES (@Value,@StudentId)";
|
||||
@ -62,7 +62,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
{
|
||||
using var connection = new
|
||||
NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryDelete = @"DELETE FROM Statemant
|
||||
var queryDelete = @"DELETE FROM Statement11
|
||||
WHERE Id=@id";
|
||||
connection.Execute(queryDelete, new { id });
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = @"SELECT * FROM Statemant";
|
||||
var querySelect = @"SELECT * FROM Statement11";
|
||||
var statements = connection.Query<Statement>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(statements));
|
||||
@ -92,13 +92,13 @@ namespace Academic_Performance.Repositories.Implementations
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Statement> ReadStatement()
|
||||
public IEnumerable<Statement> ReadStatement(DateTime? dateForm = null, DateTime? dateTo = null)
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Statemant";
|
||||
var querySelect = "SELECT * FROM Statement11";
|
||||
var statements = connection.Query<Statement>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(statements));
|
||||
|
Loading…
Reference in New Issue
Block a user