Exemplo n.º 1
0
        public static decimal?FindAddressByRow(ICollection <AddressBook> collection, AddressBookWrapper item)
        {
            if (collection == null || collection.Count == 0)
            {
                return(null);
            }

            AddressBook addressBook = null;

            if (!string.IsNullOrEmpty(item.ADDRESSBOOKRAW))
            {
                addressBook = collection.FirstOrDefault(ab => ab.ADDRESSBOOKRAW == item.ADDRESSBOOKRAW);
                if (addressBook != null)
                {
                    return(addressBook.ADDRESSBOOKID);
                }
            }

            if (!string.IsNullOrEmpty(string.Format("{0}{1}{2}{3}{4}", item.ADDRESSBOOKAPARTMENT, item.ADDRESSBOOKBUILDING, item.ADDRESSBOOKCITY, item.ADDRESSBOOKREGION, item.ADDRESSBOOKSTREET)))
            {
                addressBook = collection.FirstOrDefault(p =>
                                                        p.ADDRESSBOOKAPARTMENT.EqIgnoreCase(item.ADDRESSBOOKAPARTMENT) &&
                                                        p.ADDRESSBOOKBUILDING.EqIgnoreCase(item.ADDRESSBOOKBUILDING) &&
                                                        p.ADDRESSBOOKCITY.EqIgnoreCase(item.ADDRESSBOOKCITY) &&
                                                        p.ADDRESSBOOKREGION.EqIgnoreCase(item.ADDRESSBOOKREGION) &&
                                                        p.ADDRESSBOOKSTREET.EqIgnoreCase(item.ADDRESSBOOKSTREET));
            }
            return(addressBook != null ? addressBook.ADDRESSBOOKID : collection.Max(p => p.ADDRESSBOOKID));
        }
Exemplo n.º 2
0
        public static bool IsAddressEmpty(AddressBookWrapper address)
        {
            if (address == null)
            {
                return(true);
            }

            var result = string.IsNullOrEmpty(address.ADDRESSBOOKINDEXSTR) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKCOUNTRY) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKREGION) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKCITY) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKDISTRICT) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKSTREET) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKBUILDING) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKAPARTMENT) &&
                         string.IsNullOrEmpty(address.ADDRESSBOOKRAW);

            return(result);
        }