public int GetLocalContactsContainsPopup(DBpopupContact item)
        {
            List <DBpopupContact> profile = new List <DBpopupContact>();

            try
            {
                SQLiteConnection connection = GetConnection();
                var table = connection.Table <DBpopupContact>();
                //var bas = table.First();

                foreach (var pp in table)
                {
                    //profile.Add(pp);
                    if (!string.IsNullOrEmpty(item.email) && pp.email == item.email)
                    {
                        profile.Add(pp);
                    }
                    if (!string.IsNullOrEmpty(item.barcode) && pp.barcode == item.barcode)
                    {
                        profile.Add(pp);
                    }
                }

                //return profile.Contains(item);
            }
            catch       //(Exception ex)
            {
                //                Console.WriteLine (ex.Message);
                // not sure what to do about logging on the phone
            }


            return(profile.Count);
        }
        public void UpdatePopupContact(DBpopupContact item)
        {
            SQLiteConnection connection = GetConnection();

            connection.CreateTable <DBpopupContact> ();
            connection.Update(item);
        }
 public void ClearContactsPopupById(DBpopupContact _item)
 {
     try
     {
         SQLiteConnection connection = GetConnection();
         connection.CreateTable <DBpopupContact>();
         //connection.Query<DBpopupContact> ("DELETE FROM DBpopupContact WHERE _id = '?'", Id);
         connection.Delete(_item);
     }
     catch//(Exception ex)
     {
         //              Console.WriteLine (ex.Message);
     }
 }
        public void AddLocalContactPopup(DBpopupContact item)
        {
            SQLiteConnection connection = GetConnection();

            connection.CreateTable <DBpopupContact>();
            DBlocalContact lc = new DBlocalContact();

            lc.company   = item.company;
            lc.email     = item.email;
            lc.firstname = item.firstName;
            lc.lastname  = item.lastName;
            lc.phone     = item.phone;
            //lc.source = item.source;
            lc.city    = item.city;
            lc.zip     = item.zip;
            lc.street  = item.street;
            lc.country = item.country;
            //lc.uuid = item.uuid;
            //AddLocalContact (lc);
            connection.Insert(item);
        }