Added all DataModels, Converters and Menagments
This commit is contained in:
parent
eea7c149b0
commit
82d321f771
29
DBconnection/Converters/ConvertContactPerson.cs
Normal file
29
DBconnection/Converters/ConvertContactPerson.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Converters
|
||||
{
|
||||
class ConvertContactPerson
|
||||
{
|
||||
public static ContactPersons ConvertDBContactPersonToContactPerson (ContactPerson dbContactPerson)
|
||||
{
|
||||
ContactPersons contactPersons = new ContactPersons
|
||||
{
|
||||
Id = dbContactPerson.Id,
|
||||
IdCustomer = dbContactPerson.IdCustomer,
|
||||
IdUser = dbContactPerson.IdUser,
|
||||
Name = dbContactPerson.Name,
|
||||
Surname = dbContactPerson.Surname,
|
||||
TelephonNumber = dbContactPerson.TelephonNumber,
|
||||
Email = dbContactPerson.Email,
|
||||
Position = dbContactPerson.Position,
|
||||
IsDeleted = dbContactPerson.IsDeleted
|
||||
};
|
||||
|
||||
return contactPersons;
|
||||
}
|
||||
}
|
||||
}
|
25
DBconnection/Converters/ConvertNote.cs
Normal file
25
DBconnection/Converters/ConvertNote.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Converters
|
||||
{
|
||||
class ConvertNote
|
||||
{
|
||||
public static Notes ConvertDBNoteToNote (Note dbNote)
|
||||
{
|
||||
Notes note = new Notes
|
||||
{
|
||||
Id = dbNote.Id,
|
||||
IdCustomer = dbNote.IdCustomer,
|
||||
IdUser = dbNote.IdUser,
|
||||
Contents = dbNote.Contents,
|
||||
IsDeleted = dbNote.IsDeleted
|
||||
};
|
||||
|
||||
return note;
|
||||
}
|
||||
}
|
||||
}
|
23
DBconnection/Converters/ConvertTrade.cs
Normal file
23
DBconnection/Converters/ConvertTrade.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using DataModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Converters
|
||||
{
|
||||
class ConvertTrade
|
||||
{
|
||||
public static Trades ConvertDBTradeToTrade(Trade dbTrade)
|
||||
{
|
||||
Trades trade = new Trades
|
||||
{
|
||||
Id = dbTrade.Id,
|
||||
Name = dbTrade.Name
|
||||
};
|
||||
|
||||
return trade;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -54,9 +54,16 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Converters\ConvertContactPerson.cs" />
|
||||
<Compile Include="Converters\ConvertCustomer.cs" />
|
||||
<Compile Include="Converters\ConvertNote.cs" />
|
||||
<Compile Include="Converters\ConvertRole.cs" />
|
||||
<Compile Include="Converters\ConvertTrade.cs" />
|
||||
<Compile Include="Menagments\ContactPersonMenagment.cs" />
|
||||
<Compile Include="Menagments\CustomerMenagment.cs" />
|
||||
<Compile Include="Menagments\NoteMenagment.cs" />
|
||||
<Compile Include="Menagments\RoleMenagment.cs" />
|
||||
<Compile Include="Menagments\TradeMenagment.cs" />
|
||||
<Compile Include="Menagments\UserMenagment.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
26
DBconnection/Menagments/ContactPersonMenagment.cs
Normal file
26
DBconnection/Menagments/ContactPersonMenagment.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using DataModels;
|
||||
using DBconnection.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Menagments
|
||||
{
|
||||
public class ContactPersonMenagment
|
||||
{
|
||||
public List<ContactPersons> GetAllContactPersons()
|
||||
{
|
||||
LINQconecctionDataContext baza = new LINQconecctionDataContext();
|
||||
List<ContactPerson> dbContactPerson = baza.ContactPerson.ToList();
|
||||
List<ContactPersons> contactPersons = new List<ContactPersons>();
|
||||
|
||||
foreach (var dbCP in dbContactPerson)
|
||||
{
|
||||
contactPersons.Add(ConvertContactPerson.ConvertDBContactPersonToContactPerson(dbCP));
|
||||
}
|
||||
|
||||
return contactPersons;
|
||||
}
|
||||
}
|
||||
}
|
26
DBconnection/Menagments/CustomerMenagment.cs
Normal file
26
DBconnection/Menagments/CustomerMenagment.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using DataModels;
|
||||
using DBconnection.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Menagments
|
||||
{
|
||||
public class CustomerMenagment
|
||||
{
|
||||
public List<Customers> GetAllCustomers()
|
||||
{
|
||||
LINQconecctionDataContext baza = new LINQconecctionDataContext();
|
||||
List<Customer> dbCustomers = baza.Customer.ToList();
|
||||
List<Customers> customers = new List<Customers>();
|
||||
|
||||
foreach (var dbCust in dbCustomers)
|
||||
{
|
||||
customers.Add(ConvertCustomer.ConvertDBCustomerToCustomer(dbCust));
|
||||
}
|
||||
|
||||
return customers;
|
||||
}
|
||||
}
|
||||
}
|
25
DBconnection/Menagments/NoteMenagment.cs
Normal file
25
DBconnection/Menagments/NoteMenagment.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using DataModels;
|
||||
using DBconnection.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Menagments
|
||||
{
|
||||
public class NoteMenagment
|
||||
{
|
||||
public List<Notes> GetAllNotes()
|
||||
{
|
||||
LINQconecctionDataContext baza = new LINQconecctionDataContext();
|
||||
List<Note> dbNotes = baza.Note.ToList();
|
||||
List<Notes> notes = new List<Notes>();
|
||||
|
||||
foreach (var dbNote in dbNotes)
|
||||
{
|
||||
notes.Add(ConvertNote.ConvertDBNoteToNote(dbNote));
|
||||
}
|
||||
return notes;
|
||||
}
|
||||
}
|
||||
}
|
25
DBconnection/Menagments/TradeMenagment.cs
Normal file
25
DBconnection/Menagments/TradeMenagment.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using DataModels;
|
||||
using DBconnection.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DBconnection.Menagments
|
||||
{
|
||||
public class TradeMenagment
|
||||
{
|
||||
public List<Trades> GetAllTrades()
|
||||
{
|
||||
LINQconecctionDataContext baza = new LINQconecctionDataContext();
|
||||
List<Trade> dbTrades = baza.Trade.ToList();
|
||||
List<Trades> trades = new List<Trades>();
|
||||
|
||||
foreach (var dbtrade in dbTrades)
|
||||
{
|
||||
trades.Add(ConvertTrade.ConvertDBTradeToTrade(dbtrade));
|
||||
}
|
||||
return trades;
|
||||
}
|
||||
}
|
||||
}
|
24
DataModels/ContactPersons.cs
Normal file
24
DataModels/ContactPersons.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DataModels
|
||||
{
|
||||
public class ContactPersons
|
||||
{
|
||||
int id, idCustomer, idUser;
|
||||
string name, surname, telephonNumber, email, position;
|
||||
bool isDeleted;
|
||||
|
||||
public int Id { get => id; set => id = value; }
|
||||
public int IdCustomer { get => idCustomer; set => idCustomer = value; }
|
||||
public int IdUser { get => idUser; set => idUser = value; }
|
||||
public string Name { get => name; set => name = value; }
|
||||
public string Surname { get => surname; set => surname = value; }
|
||||
public string TelephonNumber { get => telephonNumber; set => telephonNumber = value; }
|
||||
public string Email { get => email; set => email = value; }
|
||||
public string Position { get => position; set => position = value; }
|
||||
public bool IsDeleted { get => isDeleted; set => isDeleted = value; }
|
||||
}
|
||||
}
|
@ -40,8 +40,11 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ContactPersons.cs" />
|
||||
<Compile Include="Customers.cs" />
|
||||
<Compile Include="Notes.cs" />
|
||||
<Compile Include="Role.cs" />
|
||||
<Compile Include="Trades.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
20
DataModels/Notes.cs
Normal file
20
DataModels/Notes.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DataModels
|
||||
{
|
||||
public class Notes
|
||||
{
|
||||
int id, idCustomer, idUser;
|
||||
string contents;
|
||||
bool isDeleted;
|
||||
|
||||
public int Id { get => id; set => id = value; }
|
||||
public int IdCustomer { get => idCustomer; set => idCustomer = value; }
|
||||
public int IdUser { get => idUser; set => idUser = value; }
|
||||
public string Contents { get => contents; set => contents = value; }
|
||||
public bool IsDeleted { get => isDeleted; set => isDeleted = value; }
|
||||
}
|
||||
}
|
16
DataModels/Trades.cs
Normal file
16
DataModels/Trades.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace DataModels
|
||||
{
|
||||
public class Trades
|
||||
{
|
||||
int id;
|
||||
string name;
|
||||
|
||||
public int Id { get => id; set => id = value; }
|
||||
public string Name { get => name; set => name = value; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user