public void BusinessObjectWithChildList()
        {
            UnitTestContext context   = GetContext();
            DateTime        birthdate = new DateTime(1980, 2, 3);

            Person expectedPerson = new Person();

            expectedPerson.Name         = "test";
            expectedPerson.Unserialized = "should be null";
            expectedPerson.Birthdate    = birthdate;

            AddressList expectedAddressList = new AddressList();

            expectedPerson.Addresses = expectedAddressList;

            Address expectedA1 = new Address();

            expectedA1.City    = "Minneapolis";
            expectedA1.ZipCode = "55414";

            Address expectedA2 = new Address();

            expectedA2.City    = "Eden Prairie";
            expectedA2.ZipCode = "55403";

            expectedAddressList.Add(expectedA1);
            expectedAddressList.Add(expectedA2);
            expectedPerson.PrimaryAddress = expectedAddressList[1];

            var buffer       = MobileFormatter.Serialize(expectedPerson);
            var actualPerson = (Person)MobileFormatter.Deserialize(buffer);

            context.Assert.AreEqual(expectedPerson.Name, actualPerson.Name);
            context.Assert.AreEqual(expectedPerson.Birthdate, actualPerson.Birthdate);
            context.Assert.AreEqual(expectedPerson.Age, actualPerson.Age);
            context.Assert.AreEqual(actualPerson.Unserialized, string.Empty);
            context.Assert.IsNotNull(expectedPerson.Unserialized);
            context.Assert.AreSame(expectedPerson.PrimaryAddress, expectedAddressList[1]);

            var actualAddressList = actualPerson.Addresses;

            context.Assert.IsNotNull(actualAddressList);
            context.Assert.AreEqual(expectedAddressList.Count, actualAddressList.Count);

            context.Assert.AreEqual(expectedAddressList[0].City, actualAddressList[0].City);
            context.Assert.AreEqual(expectedAddressList[0].ZipCode, actualAddressList[0].ZipCode);

            context.Assert.AreEqual(expectedAddressList[1].City, actualAddressList[1].City);
            context.Assert.AreEqual(expectedAddressList[1].ZipCode, actualAddressList[1].ZipCode);

            context.Assert.AreSame(actualPerson.PrimaryAddress, actualAddressList[1]);
            context.Assert.Success();
            context.Complete();
        }
Beispiel #2
0
        private async void LoadData()
        {
            try
            {
                isLoaded = false;
                isBusy   = true;
                AddressList.Clear();
                responseObject = await trackingService.GetAddressParties(requestObject.JobType, requestObject.JobId);

                if (responseObject.ReturnCode == "ERR_SUCCESS")
                {
                    foreach (AddressParty a in responseObject.AddressParties)
                    {
                        AddressList.Add(a);
                    }
                }
                else
                {
                    //Error
                }
            }
            catch (Exception e)
            {
                //Exception
            }
            finally
            {
                isBusy   = false;
                isLoaded = true;
            }
        }
Beispiel #3
0
        private void ImportFromFile()
        {
            Response <string[]> resp = DataManager.OpenFileDialog();

            if (resp.Errors.Any())
            {
                Errors = resp.Errors.GetErrors();
                Status = "Encountered an error while reading from file!";
            }
            else if (resp.Result != null)
            {
                int addrCount = 0;
                foreach (var s in resp.Result)
                {
                    // remove possible white space
                    string addr = s.Replace(" ", "");

                    VerificationResult vr = ValidateAddr(addr);
                    if (vr.IsVerified)
                    {
                        AddressList.Add(new GroestlcoinAddress()
                        {
                            Address = addr
                        });
                        addrCount++;
                    }
                    else
                    {
                        Errors += Environment.NewLine + vr.Error + ": " + addr;
                    }
                }
                Status = $"Successfully added {addrCount} addresses.";
            }
        }
		public void Person_contact_from_supplier()
		{
			var message = Mime.Parse(@"..\..\Data\MailContextFixture\Unparse_Protek.eml");
			var context = new MailContext();
			var name = Generator.Name();
			var email = name + "@test.ru";
			var fromList = new AddressList();
			fromList.Add(new MailboxAddress(email));

			var supplier = TestSupplier.CreateNaked(session);
			supplier.Name = name;
			session.Save(supplier);
			var group = supplier.ContactGroupOwner.AddContactGroup(ContactGroupType.MiniMails);
			session.Save(group);
			group.AddPerson("Tестовая персона");
			session.Save(group.Persons[0]);
			var contact = group.Persons[0].AddContact(ContactType.Email, email);
			session.Save(contact);

			FlushAndCommit();
			context.ParseMime(message, fromList);

			Assert.AreEqual(context.Suppliers.Count, 1);
			Assert.AreEqual(context.Suppliers[0].Name, name);
		}
        private void Seed()
        {
            if (_isDataSeeded)
            {
                return;
            }

            Customers.Add(
                new Customer
                {
                    Id = Guid.NewGuid(),
                    CustomerFirstname = "Hans",
                    CustomerSurname = "Mustermann",
                    CustomerAddress =
                        new Address
                        {
                            Id = Guid.NewGuid(),
                            StreetText = "Musterstrasse 5",
                            Zip = 1050,
                            City = "Wien",
                            Country = "Österreich"
                        },
                    FavouriteShopStreetText = "Mariahilfer Straße 98",
                    FavouriteShopZip = 1060,
                    FavouriteShopCity = "Wien",
                    CustomerType = "green"
                }
            );
            Customers.Add(
                new Customer
                {
                    Id = Guid.NewGuid(),
                    CustomerFirstname = "Herbert",
                    CustomerSurname = "Schubert",
                    CustomerType = "red",
                    CustomerAddress =
                        new Address
                        {
                            Id = Guid.NewGuid(),
                            StreetText = "Strassenweg 23",
                            Zip = 1200,
                            City = "Wien",
                            Country = "Österreich"
                        }
                }
            );
            AddressList.Add(
                new Address
                {
                    Id = Guid.NewGuid(),
                    StreetText = "Testweg 98",
                    Zip = 1110,
                    City = "Wien",
                    Country = "Österreich"
                }
            );

            SaveChanges();
            _isDataSeeded = true;
        }
Beispiel #6
0
        public static AddressList GetList()
        {
            AddressList    aList  = null;
            MyDBConnection myConn = new MyDBConnection();
            SqlConnection  conn   = new SqlConnection();
            SqlDataReader  dr;
            SqlCommand     cmd = null;
            string         sql = "Select * from AquaOne.dbo.Address";

            // Open the connection
            conn = myConn.OpenDB();
            cmd  = new SqlCommand(sql, conn);

            dr = cmd.ExecuteReader();

            if (dr.HasRows)
            {
                aList = new AddressList();
                while (dr.Read())
                {
                    aList.Add(FillDataRecord(dr));
                }
            }

            cmd.Dispose();
            myConn.CloseDB(conn);
            return(aList);
        }
Beispiel #7
0
        async void Init()
        {
            var soapClient = new Bubble.ContactsSoapClient();
            IEnumerable <Person>  persons;
            IEnumerable <Email>   ems;
            IEnumerable <Address> ads;
            IEnumerable <Phone>   phs;

            persons = await soapClient.GetPeopleAsync();

            foreach (var dude in persons)
            {
                ContactList.Add(dude);
            }
            ems = await soapClient.GetEmailsAsync();

            foreach (var e in ems)
            {
                EmailList.Add(e);
            }
            ads = await soapClient.GetAddressesAsync();

            foreach (var a in ads)
            {
                AddressList.Add(a);
            }
            phs = await soapClient.GetPhonesAsync();

            foreach (var p in phs)
            {
                PhoneList.Add(p);
            }

            foreach (var dude in ContactList)
            {
                foreach (var e in EmailList)
                {
                    if (dude.PID == e.PersonID)
                    {
                        dude.elist.Add(e);
                    }
                }
                foreach (var a in AddressList)
                {
                    if (dude.PID == a.PersonID)
                    {
                        dude.alist.Add(a);
                    }
                }
                foreach (var p in PhoneList)
                {
                    if (dude.PID == p.PersonID)
                    {
                        dude.plist.Add(p);
                    }
                }
            }
        }
Beispiel #8
0
 private AddressList GetAddresses(Boolean refresh)
 {
     if (_addresses.IsNull() || refresh)
     {
         _addresses = new AddressList();
         _addresses.Add(AddressTest.GetOneAddress(GetUserContext()));
     }
     return(_addresses);
 }
Beispiel #9
0
 public AddAddressForm()
 {
     InitializeComponent();
     AddressList.Add(new Address());
     addressListBindingSource.DataSource = AddressList;
     addressListDataGridView.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
     addressListDataGridView.ColumnHeadersBorderStyle           = DataGridViewHeaderBorderStyle.Sunken;
     addressListDataGridView.ColumnHeadersDefaultCellStyle.Font = new Font("Calibri", 14F, FontStyle.Bold, GraphicsUnit.Pixel);
     this.Text = "Добавление в список адресов";
 }
Beispiel #10
0
        protected void lnkEditMailingAddress_OnCommand(object sender, CommandEventArgs e)
        {
            AddressList al = new AddressList();

            al.Add(AddressManager.GetAddressById(_mailingAddress.AddressID));
            fview_EditMailingAddress.DataSource = al;
            fview_EditMailingAddress.DataBind();

            this.mPopupEdit_MailingAddress.Show();
        }
Beispiel #11
0
        private void AddAddress(int addr)
        {
            // Add to addresslist
            AddressList.Add(addr);

            // Add list item
            var item = GetAddressItem(addr);

            ItemPanel_Values.Items.Add(item);
            ItemPanel_Values.SelectedItem = item;
            ItemPanel_Values.Refresh();
        }
Beispiel #12
0
        private void ImportFromText()
        {
            IWindowManager  winManager = new ImportWindowManager();
            ImportViewModel vm         = new ImportViewModel();

            winManager.Show(vm);

            if (vm.AddressList != null && vm.AddressList.Count != 0)
            {
                vm.AddressList.ForEach(x => AddressList.Add(x));
                Status = $"Successfully added {vm.AddressList.Count} addresses.";
            }
        }
Beispiel #13
0
        public void SquareBracketOperator()
        {
            AddressList newAddressList, oldAddressList;
            Int32       addressIndex;

            oldAddressList = GetAddresses(true);
            newAddressList = new AddressList();
            for (addressIndex = 0; addressIndex < oldAddressList.Count; addressIndex++)
            {
                newAddressList.Add(oldAddressList[oldAddressList.Count - addressIndex - 1]);
            }
            for (addressIndex = 0; addressIndex < oldAddressList.Count; addressIndex++)
            {
                Assert.AreEqual(newAddressList[addressIndex], oldAddressList[oldAddressList.Count - addressIndex - 1]);
            }
        }
Beispiel #14
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var SessionAddressListJSON = HttpContext.Session.GetString("SessionAddresses");

            if (SessionAddressListJSON == null)
            {
                AddressList = new List <Address>();
            }
            else
            {
                AddressList = JsonConvert.DeserializeObject <List <Address> >(SessionAddressListJSON);
            }

            AddressList.Add(Address);
            HttpContext.Session.SetString("SessionAddresses", JsonConvert.SerializeObject(AddressList));
            return(RedirectToPage("./Address"));
        }
        protected static string MergeAddressList(CRSMEmail email, string addressList, string sourceList)
        {
            if (string.IsNullOrEmpty(addressList))
            {
                return(sourceList);
            }

            AddressList result = new AddressList();
            var         index  = new HashSet <string>();

            foreach (Mailbox box in AddressList.Parse(addressList))
            {
                if (index.Contains(box.Address))
                {
                    continue;
                }
                if (email.MailTo != null && email.MailTo.Contains(box.Address))
                {
                    continue;
                }
                if (email.MailCc != null && email.MailCc.Contains(box.Address))
                {
                    continue;
                }
                if (email.MailBcc != null && email.MailBcc.Contains(box.Address))
                {
                    continue;
                }
                index.Add(box.Address);

                result.Add(box);
            }
            return(result.Count == 0
                ? sourceList
                : (string.IsNullOrEmpty(sourceList)
                    ? result.ToString()
                    : sourceList + "; " + result));
        }
        public static AddressList AddressTranslate(DataTypes.Address[] addresses)
        {
            AddressList list = new AddressList();

            BusinessEntities.Address address;

            for (int i = 0; i < addresses.Length; i++)
            {
                address                   = new BusinessEntities.Address();
                address.AddressId         = addresses[i].AddressId;
                address.CustomerId        = addresses[i].CustomerId;
                address.StreetAddress     = addresses[i].StreetAddress;
                address.City              = addresses[i].City;
                address.State             = addresses[i].State;
                address.ZipCode           = addresses[i].Zipcode;
                address.IsPrimaryShipping = addresses[i].IsPrimaryShipping;
                address.IsActive          = addresses[i].IsActive;

                list.Add(address);
            }

            return(list);
        }
Beispiel #17
0
        public void ChangeAddress(Guid housingDepartmentId, string address)
        {
            var addressItem = AddressList.FirstOrDefault(x => x.HousingDepartmentId == housingDepartmentId);

            if (addressItem == null)
            {
                addressItem = new JobAddress
                {
                    HousingDepartmentId = housingDepartmentId,
                    Address             = address
                };

                AddressList.Add(addressItem);
            }
            else
            {
                addressItem.Address = address;
            }

            RaiseEvent(new JobAddressChanged {
                AddressList = AddressList
            });
        }
        private bool NewAddress(string itemID)
        {
            Address newItem = new Address();

            //all new records will be give a negative int autoid...
            //when they are updated then sql will generate one for them overiding this set value...
            //it will allow us to give uniqueness to the tempory new records...
            //Before they are updated to the entity and given an autoid...
            //we use a negative number and keep subtracting by 1 for each new item added...
            //This will allow it to alwasy be unique and never interfere with SQL's positive autoid...
            _newAddressAutoId       = _newAddressAutoId - 1;
            newItem.AutoID          = _newAddressAutoId;
            newItem.AddressID       = itemID;
            newItem.CompanyID       = ClientSessionSingleton.Instance.CompanyID;
            newItem.IsValid         = 1;
            newItem.NotValidMessage = "New Record Key Field/s Are Required.";
            AddressList.Add(newItem);
            _serviceAgent.AddToAddressRepository(newItem);
            SelectedAddress = AddressList.LastOrDefault();

            AllowEdit = true;
            Dirty     = false;
            return(true);
        }
Beispiel #19
0
        private AddressList GetAddressList(Int32 customerId)
        {
            AddressList addressList = new AddressList();
            DbCommand   command     = m_CustomerDb.GetStoredProcCommand("usp_Address_List");

            m_CustomerDb.AddInParameter(command, "CustomerId", DbType.Int32);
            m_CustomerDb.SetParameterValue(command, "CustomerId", customerId);

            using (IDataReader reader = m_CustomerDb.ExecuteReader(command))
            {
                Address address;

                Int32 addressIdOrdinal         = reader.GetOrdinal("AddressId");
                Int32 cityOrdinal              = reader.GetOrdinal("City");
                Int32 stateOrdinal             = reader.GetOrdinal("State");
                Int32 zipCodeOrdinal           = reader.GetOrdinal("Zipcode");
                Int32 streetAddressOrdinal     = reader.GetOrdinal("Address");
                Int32 isPrimaryShippingOrdinal = reader.GetOrdinal("IsPrimaryShipping");

                while (reader.Read())
                {
                    if (!reader.IsDBNull(addressIdOrdinal))
                    {
                        address = new Address();

                        address.CustomerId = customerId;
                        address.IsActive   = true;

                        address.AddressId = reader.GetInt32(addressIdOrdinal);

                        if (!reader.IsDBNull(stateOrdinal))
                        {
                            address.State = reader.GetString(stateOrdinal);
                        }

                        if (!reader.IsDBNull(cityOrdinal))
                        {
                            address.City = reader.GetString(cityOrdinal);
                        }

                        if (!reader.IsDBNull(streetAddressOrdinal))
                        {
                            address.StreetAddress = reader.GetString(streetAddressOrdinal);
                        }

                        if (!reader.IsDBNull(zipCodeOrdinal))
                        {
                            address.ZipCode = reader.GetString(zipCodeOrdinal);
                        }

                        if (!reader.IsDBNull(isPrimaryShippingOrdinal))
                        {
                            address.IsPrimaryShipping = reader.GetBoolean(isPrimaryShippingOrdinal);
                        }

                        addressList.Add(address);
                    }
                }
            }
            return(addressList);
        }
Beispiel #20
0
    public void BusinessObjectWithChildList()
    {
      UnitTestContext context = GetContext();
      DateTime birthdate = new DateTime(1980, 2, 3);

      Person expectedPerson = new Person();
      expectedPerson.Name = "test";
      expectedPerson.Unserialized = "should be null";
      expectedPerson.Birthdate = birthdate;

      AddressList expectedAddressList = new AddressList();
      expectedPerson.Addresses = expectedAddressList;
      
      Address expectedA1 = new Address();
      expectedA1.City = "Minneapolis";
      expectedA1.ZipCode = "55414";
      
      Address expectedA2 = new Address();
      expectedA2.City = "Eden Prairie";
      expectedA2.ZipCode = "55403";

      expectedAddressList.Add(expectedA1);
      expectedAddressList.Add(expectedA2);
      expectedPerson.PrimaryAddress = expectedAddressList[1];

      var buffer = MobileFormatter.Serialize(expectedPerson);
      var actualPerson = (Person)MobileFormatter.Deserialize(buffer);

      context.Assert.AreEqual(expectedPerson.Name, actualPerson.Name);
      context.Assert.AreEqual(expectedPerson.Birthdate, actualPerson.Birthdate);
      context.Assert.AreEqual(expectedPerson.Age, actualPerson.Age);
      context.Assert.AreEqual(actualPerson.Unserialized, string.Empty);
      context.Assert.IsNotNull(expectedPerson.Unserialized);
      context.Assert.AreSame(expectedPerson.PrimaryAddress, expectedAddressList[1]);

      var actualAddressList = actualPerson.Addresses;
      context.Assert.IsNotNull(actualAddressList);
      context.Assert.AreEqual(expectedAddressList.Count, actualAddressList.Count);

      context.Assert.AreEqual(expectedAddressList[0].City, actualAddressList[0].City);
      context.Assert.AreEqual(expectedAddressList[0].ZipCode, actualAddressList[0].ZipCode);

      context.Assert.AreEqual(expectedAddressList[1].City, actualAddressList[1].City);
      context.Assert.AreEqual(expectedAddressList[1].ZipCode, actualAddressList[1].ZipCode);

      context.Assert.AreSame(actualPerson.PrimaryAddress, actualAddressList[1]);
      context.Assert.Success();
      context.Complete();
    }