Conversation
Bushminkina
left a comment
There was a problem hiding this comment.
Если указываю неправильный пароль выполняет вход, с правильным паролем выдаёт ошибку
| { | ||
| return new List<TrubleTicket>(); | ||
| return new List<TroubleTicket>(); | ||
| } | ||
| else |
There was a problem hiding this comment.
перед else стоит return
| else | ||
| { | ||
| return JsonProvider.Deserialize<TrubleTicket>(trubleTicketsFileName); | ||
| return JsonProvider.Deserialize<TroubleTicket>(troubleTicketsFileName); |
There was a problem hiding this comment.
для чего второй раз десериализуем?
| { | ||
| public int Id { get; set; } | ||
| public string Status { get; set; } | ||
| public int CreateUser { get; set; } |
There was a problem hiding this comment.
название CreateUser, а тип данных int
| @@ -0,0 +1,44 @@ | |||
| namespace HelpDeskWinFormsApp | |||
| { | |||
| public static class AppConstants | |||
There was a problem hiding this comment.
//лучше разнести по разным классам по функциональности
|
|
||
| public static (bool IsValid, string Message) ValidateName(string inputName) | ||
| { | ||
| var name = inputName?.Trim() ?? ""; |
| return; | ||
| } | ||
|
|
||
| if (statusTroubleTicketComboBox.Text != lastStatus) |
There was a problem hiding this comment.
можно если статус равен предыдущему - выйти из метода и уменьшить вложенность
Bushminkina
left a comment
There was a problem hiding this comment.
Интерфейсы разделены правильно, но у нас остался класс JsonStorage который одновременно работает и с пользователем и с заявками - это нарушает принцип единственной ответственности, буква S в SOLID (https://teletype.in/@csharpmagazine/solid).
Попробуй также разделить класс JsonStorage.
| foreach (var file in files) | ||
| { | ||
| if (File.Exists(file)) | ||
| { | ||
| try | ||
| { | ||
| string content = File.ReadAllText(file); | ||
|
|
||
| if (content.Trim().StartsWith("[") || content.Trim().StartsWith("{")) | ||
| { | ||
| File.Copy(file, file + ".backup", true); | ||
|
|
||
| FileProvider.Put(file, content); | ||
| } | ||
| } | ||
| catch | ||
| { | ||
|
|
||
| } |
There was a problem hiding this comment.
просится в класс FileProvider в отдельный метод, список названий файлов можно в метод передать
No description provided.