Esempio n. 1
0
        public void SetAddress(Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }
            var existingAddress = CompanyAddresses.FirstOrDefault(a => a.AddressType.AddressTypeCode == address.AddressType.AddressTypeCode);

            if (existingAddress != null)
            {
                CompanyAddresses.Remove(existingAddress);
            }
            CompanyAddresses.Add(address);
        }
Esempio n. 2
0
        private void SetAddress(AddressViewModel addressData)
        {
            if (addressData == null)
            {
                throw new ArgumentNullException(nameof(addressData));
            }
            var existingAddress = CompanyAddresses.FirstOrDefault(a => a.AddressType.AddressTypeCode == addressData.AddressType.AddressTypeCode);

            if (existingAddress != null)
            {
                CompanyAddresses.Remove(existingAddress);
            }
            CompanyAddresses.Add(addressData);
        }
        private void PopulateLists()
        {
            //populate installed printers
            foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
            {
                InstalledPrinters.Add(printer);
            }

            //populate all companyaddresses saved in the DB
            using (var db = new Models.AppContext())
            {
                List <CompanyAddress> comps = db.CompanyAddresses.ToList();

                foreach (CompanyAddress comp in comps)
                {
                    CompanyAddresses.Add(new CompanyAddressModel(comp));
                }
            }
        }