This commit is contained in:
Userok 2024-11-01 09:57:09 +03:00
parent f21c9eea74
commit faeb43b8c2
17 changed files with 100 additions and 186 deletions

Binary file not shown.

View File

@ -1,40 +1,7 @@
{ {
"Version": 1, "Version": 1,
"WorkspaceRootPath": "C:\\Users\\profi\\source\\repos\\Zurnal\\", "WorkspaceRootPath": "C:\\Users\\profi\\source\\repos\\Zurnal\\",
"Documents": [ "Documents": [],
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\Program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\conver.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\UI\\conver.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Date\\Repository\\IGroupRepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\Date\\Repository\\IGroupRepository.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\RemoutDateBase.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\RemaDateBase\\RemoutDateBase.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\Info.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\UI\\Info.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\UserDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\RemaDateBase\\DateDao\\UserDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
}
],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
{ {
"Orientation": 0, "Orientation": 0,
@ -42,109 +9,11 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 2, "SelectedChildIndex": -1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "IGroupRepository.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Date\\Repository\\IGroupRepository.cs",
"RelativeDocumentMoniker": "Zurnal\\Date\\Repository\\IGroupRepository.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Date\\Repository\\IGroupRepository.cs",
"RelativeToolTip": "Zurnal\\Date\\Repository\\IGroupRepository.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-31T10:12:18.045Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Program.cs",
"RelativeDocumentMoniker": "Zurnal\\Program.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\Program.cs",
"RelativeToolTip": "Zurnal\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-31T09:55:53.345Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "RemoutDateBase.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\RemoutDateBase.cs",
"RelativeDocumentMoniker": "Zurnal\\RemaDateBase\\RemoutDateBase.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\RemoutDateBase.cs",
"RelativeToolTip": "Zurnal\\RemaDateBase\\RemoutDateBase.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAABYAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-31T09:55:25.475Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "conver.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\conver.cs",
"RelativeDocumentMoniker": "Zurnal\\UI\\conver.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\conver.cs",
"RelativeToolTip": "Zurnal\\UI\\conver.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAATAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-30T08:26:48.661Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"Title": "Info.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\Info.cs",
"RelativeDocumentMoniker": "Zurnal\\UI\\Info.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\UI\\Info.cs",
"RelativeToolTip": "Zurnal\\UI\\Info.cs",
"ViewState": "AgIAAAwAAAAAAAAAAAAAAAsAAAAFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-28T08:04:53.338Z"
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "PresnceDao.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs",
"RelativeDocumentMoniker": "Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs",
"RelativeToolTip": "Zurnal\\RemaDateBase\\DateDao\\PresnceDao.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAABAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-24T11:06:26.008Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"Title": "GroupDao.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs",
"RelativeDocumentMoniker": "Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs",
"RelativeToolTip": "Zurnal\\RemaDateBase\\DateDao\\GroupDao.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAwAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-24T11:06:19.494Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "UserDao.cs",
"DocumentMoniker": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\UserDao.cs",
"RelativeDocumentMoniker": "Zurnal\\RemaDateBase\\DateDao\\UserDao.cs",
"ToolTip": "C:\\Users\\profi\\source\\repos\\Zurnal\\Zurnal\\RemaDateBase\\DateDao\\UserDao.cs",
"RelativeToolTip": "Zurnal\\RemaDateBase\\DateDao\\UserDao.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-10-28T12:18:34.74Z"
} }
] ]
} }

Binary file not shown.

View File

@ -1,17 +1,22 @@
using Zurnal.domain.Models; using Zurnal.domain.Models;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Zurnal.Data.Repository; using Zurnal.Data.Repository;
using Group = System.Text.RegularExpressions.Group;
namespace Zurnal.Date.Repository namespace Zurnal.Date.Repository
{ {
internal interface IGroupRepository internal interface IGroupRepository
{ {
List<GroupLocalEntity> GetAllGroup(); List<GroupLocalEntity> GetAllGroup();
bool RemoveGroupById(int groupID); bool RemoveGroupById(int groupID);
bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup); bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup);
GroupLocalEntity GetGroupById(int groupID); bool AddGroup(GroupLocalEntity newGroup);
bool AddGroup(GroupLocalEntity newGroup); void AddGroupFromRegex(Group group);
} Group GetGroupById(int id);
IEnumerable<Group> GetAllGroups();
void UpdateGroup(Group group);
void DeleteGroup(int id);
}
internal class ServiceConfiguration internal class ServiceConfiguration
{ {

View File

@ -1,6 +1,7 @@
using Zurnal.domain.Models; using Zurnal.domain.Models;
using Zurnal.Date.LocalDate; using Zurnal.Date.LocalDate;
using Zurnal.Date.Repository; using Zurnal.Date.Repository;
using Zurnal.Domain.UseCase;
namespace Zurnal.Data.Repository namespace Zurnal.Data.Repository
{ {
@ -71,5 +72,35 @@ namespace Zurnal.Data.Repository
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
internal UserUseCase.UserLocalEntity? UpdateUser(UserUseCase.UserLocalEntity userLocalEntity)
{
throw new NotImplementedException();
}
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
System.Text.RegularExpressions.Group IGroupRepository.GetGroupById(int id)
{
throw new NotImplementedException();
}
IEnumerable<System.Text.RegularExpressions.Group> IGroupRepository.GetAllGroups()
{
throw new NotImplementedException();
}
public void UpdateGroup(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
public void DeleteGroup(int id)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -1,6 +1,7 @@
using Zurnal.Data.Repository; using Zurnal.Data.Repository;
using Zurnal.Date.Repository;
using Zurnal.domain.Models; using Zurnal.domain.Models;
using Zurnal.RemaDateBase;
namespace Zurnal.Domain.UseCase namespace Zurnal.Domain.UseCase
{ {
@ -10,18 +11,17 @@ namespace Zurnal.Domain.UseCase
internal IGroupRepository RepositoryGroupImpl { get; } internal IGroupRepository RepositoryGroupImpl { get; }
public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl) public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
{ {
_repositoryUserImpl = repositoryImpl; _repositoryUserImpl = repositoryImpl;
RepositoryGroupImpl = (IGroupRepository?)(repositoryGroupImpl ?? throw new ArgumentNullException(nameof(repositoryGroupImpl))); RepositoryGroupImpl = (IGroupRepository?)(repositoryGroupImpl ?? throw new ArgumentNullException(nameof(repositoryGroupImpl)));
} }
private object NewMethod()
{
return RepositoryGroupImpl.GetAllGroup()
.Select(it => new Group { Id = it.Id, Name = it.Name });
}
public List<Group> GetAllGroups() public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsersList()
{
return RepositoryGroupImpl.GetAllGroup()
.Select(it => new Group { Id = it.Id, Name = it.Name }).ToList();
}
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers()
.Join(RepositoryGroupImpl.GetAllGroup(), .Join(RepositoryGroupImpl.GetAllGroup(),
user => user.GroupID, user => user.GroupID,
group => group.Id, group => group.Id,
@ -36,17 +36,17 @@ namespace Zurnal.Domain.UseCase
return _repositoryUserImpl.RemoveUserByGuid(userGuid); return _repositoryUserImpl.RemoveUserByGuid(userGuid);
} }
public User UpdateUser(User user) public User UpdateUser(User user, Guid id)
{ {
UserLocalEntity userLocalEntity = new UserLocalEntity { FIO = user.FIO, GroupID = user.Group.Id, Guid = user.Guid }; UserLocalEntity userLocalEntity = new UserLocalEntity { FIO = user.FIO, GroupID = id, Guid = user.Guid };
UserLocalEntity? result = _repositoryUserImpl.UpdateUser(userLocalEntity); UserLocalEntity? result = _repositoryUserImpl.UpdateUser(userLocalEntity);
if (result == null) throw new Exception("User update failed."); if (result == null) throw new Exception("User update failed.");
Group? group = GetAllGroups().FirstOrDefault(it => it.Id == result.GroupID.ToString()); Group? group = GetAllGroups().FirstOrDefault(it => it.Id == result.GroupID.ToString());
if (group == null) throw new Exception("Group not found."); if (group == null) throw new Exception("Group not found.");
return new User { FIO = user.FIO, Guid = user.Guid, Group = group }; return new User { FIO = user.FIO, Guid = user.Guid, Group = group };
} }
private static UserLocalEnity GetUserLocalEntity(UserLocalEnity userLocalEntity) private static UserLocalEntity GetUserLocalEntity(UserLocalEntity userLocalEntity)
{ {
return userLocalEntity; return userLocalEntity;
} }
@ -59,7 +59,32 @@ namespace Zurnal.Domain.UseCase
return new User { FIO = user.FIO, Guid = user.Guid, Group = group }; return new User { FIO = user.FIO, Guid = user.Guid, Group = group };
} }
public void AddGroup(System.Text.RegularExpressions.Group group) public List<Group> GetAllGroup()
{
return new List<Group>();
}
List<GroupLocalEntity> IGroupRepository.GetAllGroup()
{
throw new NotImplementedException();
}
public bool RemoveGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
{
throw new NotImplementedException();
}
public bool AddGroup(GroupLocalEntity newGroup)
{
throw new NotImplementedException();
}
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -69,7 +94,7 @@ namespace Zurnal.Domain.UseCase
throw new NotImplementedException(); throw new NotImplementedException();
} }
IEnumerable<System.Text.RegularExpressions.Group> IGroupRepository.GetAllGroups() public IEnumerable<System.Text.RegularExpressions.Group> GetAllGroups()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -84,26 +109,11 @@ namespace Zurnal.Domain.UseCase
throw new NotImplementedException(); throw new NotImplementedException();
} }
public object GetAllGroup() internal class UserLocalEntity
{ {
throw new NotImplementedException(); public string FIO { get; set; }
public Guid GroupID { get; set; }
public Guid Guid { get; set; }
} }
public bool RemoveGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
{
throw new NotImplementedException();
}
}
internal class UserLocalEntity
{
public string FIO { get; set; }
public Guid GroupID { get; set; }
public Guid Guid { get; set; }
} }
} }

View File

@ -1,10 +1,9 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Этот код создан программой. // This code was generated by a tool.
// Исполняемая версия:4.0.30319.42000
// //
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае // Changes to this file may cause incorrect behavior and will be lost if
// повторной генерации кода. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -14,10 +13,10 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")] [assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bbb179fc02f09c0232d9bd68bc47d05d01057838")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f21c9eea749518815b6e31d670ea46d546ea1377")]
[assembly: System.Reflection.AssemblyProductAttribute("Zurnal")] [assembly: System.Reflection.AssemblyProductAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")] [assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild. // Generated by the MSBuild WriteCodeFragment class.

View File

@ -1 +1 @@
9851d28081f418a784ac6bd862df7b5379b79dbd8150859bed7e0ebb1d5cd3f1 1914265bd793edbfbb26abfea7e619e59449b0884ab15982620c0f061967d422