Exemplo n.º 1
0
 public void DeleteContact(CustomerBaseRepresentation firm, CustomerBaseRepresentation agent)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         dataSource.DeleteContact(RepresentationConverter.convertCustomer(firm), RepresentationConverter.convertCustomer(agent));
     }
 }
Exemplo n.º 2
0
 public void UpdateCustomer(CustomerBaseRepresentation customer)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(customer));
     }
 }
Exemplo n.º 3
0
 public long AddCustomer(CustomerBaseRepresentation customer)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         return(dataSource.AddCustomer(RepresentationConverter.convertCustomer(customer)));
     }
 }
Exemplo n.º 4
0
 public CustomerBaseRepresentation GetCustomerById(long id)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         return(RepresentationConverter.convertCustomer(dataSource.GetCustomerById(id)));
     }
 }
Exemplo n.º 5
0
 public ObservableCollection <CustomerBaseRepresentation> GetContacts(CustomerBaseRepresentation firm)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         List <Customers> contactList = dataSource.GetContacts(RepresentationConverter.convertCustomer(firm));
         List <CustomerBaseRepresentation> contactListRep = contactList.Select(c => RepresentationConverter.convertCustomer(c)).ToList();
         return(new ObservableCollection <CustomerBaseRepresentation>(contactListRep));
     }
 }
Exemplo n.º 6
0
        public List <RentalGroup_Representation> GetAllRentalGroups()
        {
            using (ISQLConnection dataSource = DataSource)
            {
                List <RentalGroup_Representation> rtn = new List <RentalGroup_Representation>();
                dataSource.GetAllRentalGroups().ForEach(rg => rtn.Add(RepresentationConverter.convertRentalGroup(rg)));

                return(rtn);
            }
        }
Exemplo n.º 7
0
        public List <CustomerBaseRepresentation> GetAllCustomers()
        {
            using (ISQLConnection dataSource = DataSource)
            {
                var customerList = dataSource.GetAllCustomers().Select(c => RepresentationConverter.convertCustomer(c));

                // Too much time!
                //foreach (var customer in customerList)
                //{
                //    // TODO: fill the contact list of the customer
                //    customer.contacts = GetContacts(customer);
                //}
                return(customerList.ToList());
            }
        }
Exemplo n.º 8
0
        public static ToolRepresentation convertTool(Tools tool)
        {
            ToolRepresentation convertedTool = new ToolRepresentation()
            {
                id               = tool.toolID,
                defaultDeposit   = tool.defaultDeposit,
                fromDate         = tool.fromDate,
                IDNumber         = tool.IDNumber,
                isDeleted        = tool.isDeleted,
                rentCounter      = tool.rentCounter,
                rentPrice        = tool.rentPrice,
                serialNumber     = tool.serialNumber,
                toolManufacturer = tool.toolManufacturer,
                toolName         = tool.toolName,
                toolStatus       = RepresentationConverter.convertToolStatus(tool.ToolStatuses)
            };

            return(convertedTool);
        }
Exemplo n.º 9
0
        public long AddRentalGroup(RentalGroup_Representation rentalGroup)
        {
            using (ISQLConnection dataSource = DataSource)
            {
                RentalGroups rentalGroupToAdd = RepresentationConverter.convertRentalGroup(rentalGroup);
                //foreach (RentalRepresentation rental in rentalGroup.rentals)
                //{
                //rentalGroupToAdd.Rentals.Add(RepresentationConverter.convertRental(rental));
                //dataSource.UpdateTool(RepresentationConverter.convertTool(rental.tool));
                //dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(rental.customer));
                //}
                rentalGroup.id = dataSource.AddRentalGroup(rentalGroupToAdd);

                //foreach (RentalRepresentation rental in rentalGroup.rentals)
                //{
                //    rental.group = rentalGroup;
                //    AddRental(rental);
                //}

                return(rentalGroup.id);
            }
        }
Exemplo n.º 10
0
 public DbSettingsRepresentation GetDbSettings()
 {
     return(RepresentationConverter.convertDbSettings(DataSource.GetSettings()));
 }