本文整理汇总了C#中CMModel.DBManager.AddOrUpdateContacts方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.AddOrUpdateContacts方法的具体用法?C# DBManager.AddOrUpdateContacts怎么用?C# DBManager.AddOrUpdateContacts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMModel.DBManager
的用法示例。
在下文中一共展示了DBManager.AddOrUpdateContacts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportContactsFromListContactDB
public void ImportContactsFromListContactDB(List<ContactDB> list)
{
// save/update database
DBManager db = new DBManager();
int res = db.AddOrUpdateContacts(list);
// notify UI
if (res > 0)
{
NotifyDownloadStatus(DownloadStatus.DONE, String.Format(CMController.Properties.Resources.import_num_contacts, res));
}
else
{
NotifyDownloadStatus(DownloadStatus.INFORM, CMController.Properties.Resources.no_contact_added);
}
}
示例2: SelfAddContact
// Contact
public List<int> SelfAddContact(string firstName, string middleName, string lastName, string email, string fax)
{
DBManager db = new DBManager();
AccountDB selfAccount = db.GetSelfAccount();
ContactDB contact = new ContactDB();
contact.FirstName = firstName;
contact.MiddleName = middleName;
contact.LastName = lastName;
contact.AccountId = selfAccount.Id;
List<Dictionary<string, int>> positionEmailFax = new List<Dictionary<string, int>>();
if (!String.IsNullOrEmpty(email))
{
Dictionary<string, int> dictionaryEmail = new Dictionary<string, int>();
List<EmailDB> listEmail = new List<EmailDB>();
EmailDB emailDB = new EmailDB();
emailDB.Value = email;
List<EmailTypeDB> listEmailType = db.GetAllEmailTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING);
if (listEmailType.Any())
{
for (int i = 0; i < listEmailType.Count; i++)
{
if (listEmailType[i].IsPreferred)
{
emailDB.EmailType = listEmailType[i];
dictionaryEmail.Add("Email", i);
}
}
}
listEmail.Add(emailDB);
contact.ListEmail = listEmail;
positionEmailFax.Add(dictionaryEmail);
}
if (!String.IsNullOrEmpty(fax))
{
Dictionary<string, int> dictionaryFax = new Dictionary<string, int>();
List<FaxDB> listFax = new List<FaxDB>();
FaxDB faxDB = new FaxDB();
faxDB.Value = fax;
List<FaxTypeDB> listFaxType = db.GetAllFaxTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING);
if (listFaxType.Any())
{
for (int i = 0; i < listFaxType.Count; i++)
{
if (listFaxType[i].IsPreferred)
{
faxDB.FaxType = listFaxType[i];
dictionaryFax.Add("Fax", i);
}
}
}
listFax.Add(faxDB);
contact.ListFax = listFax;
positionEmailFax.Add(dictionaryFax);
}
List<ContactDB> list = new List<ContactDB>();
list.Add(contact);
return db.AddOrUpdateContacts(list);
}
示例3: SelfAddContact
// Contact
public int SelfAddContact(string firstName, string middleName, string lastName, string email, string fax)
{
DBManager db = new DBManager();
AccountDB selfAccount = db.GetSelfAccount();
ContactDB contact = new ContactDB();
contact.FirstName = firstName;
contact.MiddleName = middleName;
contact.LastName = lastName;
contact.AccountId = selfAccount.Id;
if (!String.IsNullOrEmpty(email))
{
List<EmailDB> listEmail = new List<EmailDB>();
EmailDB emailDB = new EmailDB();
emailDB.Value = email;
List<EmailTypeDB> listEmailType = db.GetAllEmailTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING);
if (listEmailType.Count() > 0)
{
emailDB.EmailType = listEmailType[0];
}
listEmail.Add(emailDB);
contact.ListEmail = listEmail;
}
if (!String.IsNullOrEmpty(fax))
{
List<FaxDB> listFax = new List<FaxDB>();
FaxDB faxDB = new FaxDB();
faxDB.Value = fax;
List<FaxTypeDB> listFaxType = db.GetAllFaxTypeByAccountTypeName(AccountTypeDB.TYPE_SELF_STRING);
if (listFaxType.Count() > 0)
{
faxDB.FaxType = listFaxType[0];
}
listFax.Add(faxDB);
contact.ListFax = listFax;
}
List<ContactDB> list = new List<ContactDB>();
list.Add(contact);
return db.AddOrUpdateContacts(list);
}
示例4: ImportContactsFromListContactDB
public void ImportContactsFromListContactDB(List<ContactDB> list)
{
// save/update database
DBManager db = new DBManager();
int res = db.AddOrUpdateContacts(list);
// notify UI
if (res > 0)
{
NotifyDownloadStatus(DownloadStatus.DONE, String.Format(resourceLoader.GetString("import_num_contacts"), res));
}
else
{
NotifyDownloadStatus(DownloadStatus.INFORM, resourceLoader.GetString("no_contact_added"));
}
}