Add customer model and customer conventer
This commit is contained in:
parent
7c2307fabe
commit
eea7c149b0
31
DBconnection/Converters/ConvertCustomer.cs
Normal file
31
DBconnection/Converters/ConvertCustomer.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using DataModels;
|
||||
|
||||
namespace DBconnection.Converters
|
||||
{
|
||||
class ConvertCustomer
|
||||
{
|
||||
public static Customers ConvertDBCustomerToCustomer(Customer dbCustomer)
|
||||
{
|
||||
Customers customer = new Customers
|
||||
{
|
||||
Address = dbCustomer.Address,
|
||||
City = dbCustomer.City,
|
||||
Id = dbCustomer.Id,
|
||||
IdTrade = dbCustomer.Id_trade,
|
||||
IdUser = dbCustomer.Id_user,
|
||||
IsDeleted = dbCustomer.Is_deleted,
|
||||
Name = dbCustomer.Name,
|
||||
Nip = dbCustomer.NIP
|
||||
};
|
||||
|
||||
return customer;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -10,9 +10,11 @@ namespace DBconnection.Converters
|
||||
{
|
||||
public static Role ConvertDBRoleToRole(Roles dbRole)
|
||||
{
|
||||
Role role = new Role();
|
||||
role.Id = dbRole.Id;
|
||||
role.Name = dbRole.Name;
|
||||
Role role = new Role
|
||||
{
|
||||
Id = dbRole.Id,
|
||||
Name = dbRole.Name
|
||||
};
|
||||
return role;
|
||||
|
||||
}
|
||||
|
@ -10,15 +10,17 @@ namespace DBconnection
|
||||
{
|
||||
public static User ConvertDBUserToUser(Users dbUser)
|
||||
{
|
||||
User user = new User();
|
||||
user.Id = dbUser.Id;
|
||||
user.Login = dbUser.Login;
|
||||
user.Password = dbUser.Password;
|
||||
user.Name = dbUser.Name;
|
||||
user.Surname = dbUser.Surname;
|
||||
user.DateOfBirth = dbUser.DateOfBirth;
|
||||
user.IsDeleted = dbUser.Is_deleted;
|
||||
user.IdRole = dbUser.Id_role;
|
||||
User user = new User
|
||||
{
|
||||
Id = dbUser.Id,
|
||||
Login = dbUser.Login,
|
||||
Password = dbUser.Password,
|
||||
Name = dbUser.Name,
|
||||
Surname = dbUser.Surname,
|
||||
DateOfBirth = dbUser.DateOfBirth,
|
||||
IsDeleted = dbUser.Is_deleted,
|
||||
IdRole = dbUser.Id_role
|
||||
};
|
||||
|
||||
return user;
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\ConvertCustomer.cs" />
|
||||
<Compile Include="Converters\ConvertRole.cs" />
|
||||
<Compile Include="Menagments\RoleMenagment.cs" />
|
||||
<Compile Include="Menagments\UserMenagment.cs" />
|
||||
|
@ -9,7 +9,7 @@
|
||||
<Grid>
|
||||
<Button Content="TEST" HorizontalAlignment="Left" Margin="256,320,0,0" VerticalAlignment="Top" Width="274" Height="65" FontWeight="Bold" FontSize="48" Click="Button_Click"/>
|
||||
<ListBox x:Name="lista" HorizontalAlignment="Left" Height="208" Margin="110,52,0,0" VerticalAlignment="Top" Width="580"/>
|
||||
<Button x:Name="allusersbutton" Content="AllUsers" HorizontalAlignment="Left" Height="23" Margin="623,273,0,0" VerticalAlignment="Top" Width="67" Click="allusersbutton_Click"/>
|
||||
<Button x:Name="Allusersbutton" Content="AllUsers" HorizontalAlignment="Left" Height="23" Margin="623,273,0,0" VerticalAlignment="Top" Width="67" Click="Allusersbutton_Click"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -45,7 +45,7 @@ namespace DBconnection
|
||||
|
||||
}
|
||||
|
||||
private void allusersbutton_Click(object sender, RoutedEventArgs e)
|
||||
private void Allusersbutton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
23
DataModels/Customers.cs
Normal file
23
DataModels/Customers.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DataModels
|
||||
{
|
||||
public class Customers
|
||||
{
|
||||
int id, idTrade, idUser;
|
||||
string name, nip, address, city;
|
||||
bool isDeleted;
|
||||
|
||||
public int Id { get => id; set => id = value; }
|
||||
public int IdTrade { get => idTrade; set => idTrade = value; }
|
||||
public int IdUser { get => idUser; set => idUser = value; }
|
||||
public string Name { get => name; set => name = value; }
|
||||
public string Nip { get => nip; set => nip = value; }
|
||||
public string Address { get => address; set => address = value; }
|
||||
public string City { get => city; set => city = value; }
|
||||
public bool IsDeleted { get => isDeleted; set => isDeleted = value; }
|
||||
}
|
||||
}
|
@ -40,6 +40,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Customers.cs" />
|
||||
<Compile Include="Role.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user