/// <summary> /// Add one contact to Outlook /// </summary> /// <param name="c">Google cotact to add</param> /// <returns>true if add success</returns> internal bool AddNewOutlookContact(OneContact c) { Outlook.ContactItem newContact; try { newContact = c.GetOutlook(); } catch { /// Can't create Google Entity from OneContacs Class LoggerProvider.Instance.Logger.Error("Problem to read Outlook.ContactItem from GoogleSynchronizer.OneContact"); return(false); } if (newContact == null) { LoggerProvider.Instance.Logger.Error("Can't insert NULL object"); return(false); } #if (!SIMULATE_SAVE) newContact.Save(); #endif #if (!SIMULATE_SAVE) OneContact hlp = new OneContact(newContact); c.ReferenceID = newContact.EntryID; ouContacts.Add(newContact.EntryID, hlp); c.UpdateRefInGoogle(hlp.CreateReferenceID()); #endif LoggerProvider.Instance.Logger.Debug("Save update to Google"); return(true); }
/// <summary> /// Add one contact to Google /// </summary> /// <param name="c">Outlook contact to add</param> /// <returns>true if add success</returns> internal bool AddNewGoogleContact(OneContact c) { Google.Contacts.Contact goContact = null; #warning There is a problem with add google contact with Image #if (!SIMULATE_SAVE) Google.Contacts.Contact goContactNew = null; OneContact hlp = null; #endif try { goContact = c.GetGoogle(); } catch (Exception e) { /// Can't create Google Entity from OneContacs Class LoggerProvider.Instance.Logger.Error("Problem to read Google.Contacts.Contact from GoogleSynchronizer.OneContact"); LoggerProvider.Instance.Logger.Error(e); return(false);; } if (goContact == null) { LoggerProvider.Instance.Logger.Error("Can't insert NULL object"); return(false); } #if (!SIMULATE_SAVE) goContactNew = GoogleProvider.GetProvider.Insert(goContact); // If don't insert new contact to Google need continue if (goContactNew == null) { return(false); } #endif #if (!SIMULATE_SAVE) hlp = new OneContact(goContactNew); c.ReferenceID = hlp.ContactID; goContacts.Add(hlp.ContactID, hlp); c.UpdateRefInOutlook(hlp.CreateReferenceID()); #endif LoggerProvider.Instance.Logger.Debug("Save update to Outlook"); #region DEBUG infos #if (DEBUG1) LoggerProvider.Instance.Logger.Debug("Source contact MD5/Count MD5: {0}/{1}", c.MD5selfCount, Utils.CountMD5(c.SummAllData())); LoggerProvider.Instance.Logger.Debug(c.SummAllData()); LoggerProvider.Instance.Logger.Debug("Destination contact MD5/Count MD5: {0}/{1}", hlp.MD5selfCount, Utils.CountMD5(hlp.SummAllData())); LoggerProvider.Instance.Logger.Debug(hlp.SummAllData()); hlp = null; #endif #endregion return(true); }