Пример #1
0
 public void DeleteContact(CustomerBaseRepresentation firm, CustomerBaseRepresentation agent)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         dataSource.DeleteContact(RepresentationConverter.convertCustomer(firm), RepresentationConverter.convertCustomer(agent));
     }
 }
Пример #2
0
 public void UpdateCustomer(CustomerBaseRepresentation customer)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         dataSource.UpdateCustomer(RepresentationConverter.convertCustomer(customer));
     }
 }
Пример #3
0
 public long AddCustomer(CustomerBaseRepresentation customer)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         return(dataSource.AddCustomer(RepresentationConverter.convertCustomer(customer)));
     }
 }
Пример #4
0
 public CustomerBaseRepresentation GetCustomerById(long id)
 {
     using (ISQLConnection dataSource = DataSource)
     {
         return(RepresentationConverter.convertCustomer(dataSource.GetCustomerById(id)));
     }
 }
Пример #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));
     }
 }
Пример #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);
            }
        }
Пример #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());
            }
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #10
0
 public DbSettingsRepresentation GetDbSettings()
 {
     return(RepresentationConverter.convertDbSettings(DataSource.GetSettings()));
 }