本文整理汇总了C#中Contact类的典型用法代码示例。如果您正苦于以下问题:C# Contact类的具体用法?C# Contact怎么用?C# Contact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Contact类属于命名空间,在下文中一共展示了Contact类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnOk_Click
private void btnOk_Click(object sender, EventArgs e)
{
Hide();
if (ValidateInput() == false)
{
DialogResult = DialogResult.None;
return;
}
Contact contact = AppController.Instance.Contacts[cbContactname.SelectedItem.ToString()];
JabberID Jid =
new JabberID(contact.UserName.ToString(), contact.ServerName.ToString(), Settings.Default.Resource);
Contact delContact = new Contact(Jid, contact.GroupName.ToString(), LoginState.Offline);
Contact editContact = new Contact(Jid, tbnewGpName.Text.Trim(), LoginState.Offline);
UnsubscribedResponse resp = new UnsubscribedResponse(Jid);
AppController.Instance.SessionManager.Send(resp);
AppController.Instance.SessionManager.BeginSend(new RosterRemove(Jid, contact.UserName.ToString()));
AppController.Instance.Contacts.Remove(delContact);
SubscribeRequest p = new SubscribeRequest(Jid);
AppController.Instance.SessionManager.Send(p);
AppController.Instance.SessionManager.BeginSend(
new RosterAdd(Jid, contact.UserName.ToString(), tbnewGpName.Text.ToString()));
AppController.Instance.Contacts.Add(editContact);
AppController.Instance.MainWindow.UpdateContactList();
}
示例2: frmEditContact
public frmEditContact(Contact contact, IDXMenuManager menuManager)
{
InitializeComponent();
this.contact = contact;
this.bindingContact = contact.Clone();
InitEditors();
InitMenuManager(menuManager);
pePhoto.Image = bindingContact.Photo;
teFirstName.DataBindings.Add("Text", bindingContact.FullName, "FirstName");
teLastName.DataBindings.Add("Text", bindingContact.FullName, "LastName");
teMiddleName.DataBindings.Add("Text", bindingContact.FullName, "MiddleName");
icbTitle.DataBindings.Add("EditValue", bindingContact.FullName, "Title");
meLine.DataBindings.Add("Text", bindingContact.Address, "AddressLine");
cbeState.DataBindings.Add("Text", bindingContact.Address, "State");
cbeCity.DataBindings.Add("Text", bindingContact.Address, "City");
teZip.DataBindings.Add("Text", bindingContact.Address, "Zip");
teEmail.DataBindings.Add("Text", bindingContact, "Email");
tePhone.DataBindings.Add("Text", bindingContact, "Phone");
deBirthDate.DataBindings.Add("DateTime", bindingContact, "BindingBirthDate");
icbGender.DataBindings.Add("EditValue", bindingContact, "Gender");
richEditControl1.DataBindings.Add("HtmlText", bindingContact, "Note");
UpdateCaption();
InitValidationProvider();
}
示例3: SaveContact
//метод: обновляет контакт в БД, если в БД контакт с таким ID отсутствует, то создается новая запись
public void SaveContact(Contact contact)
{
Contact dbEntry = dataDBContext.Contacts.SingleOrDefault(c => c.Cont_ID == contact.Cont_ID);
if (dbEntry == null)
{
//Контакт не найден в Системе: добавим
TrimContactFields(contact);//обрежем лишние пробельчики
dataDBContext.Contacts.InsertOnSubmit(contact);
}
else
{
dbEntry.Cont_email = contact.Cont_email;
dbEntry.Cont_enterprise = contact.Cont_enterprise;
dbEntry.Cont_middlename = contact.Cont_middlename;
dbEntry.Cont_name = contact.Cont_name;
dbEntry.Cont_phone1 = contact.Cont_phone1;
dbEntry.Cont_phone2 = contact.Cont_phone2;
dbEntry.Cont_phone3 = contact.Cont_phone3;
dbEntry.Cont_position = contact.Cont_position;
dbEntry.Cont_surname = contact.Cont_surname;
TrimContactFields(dbEntry);//обрежем лишние пробельчики
}
dataDBContext.SubmitChanges();
}
示例4: ToContact
public static Contact ToContact(ContactDto dto)
{
var contact = new Contact
{
ID = dto.ID,
FirstName = dto.FirstName,
LastName = dto.LastName,
};
contact.Address.Street1 = dto.Address.Street1;
contact.Address.Street2 = dto.Address.Street2;
contact.Address.City = dto.Address.City;
contact.Address.State = dto.Address.State;
contact.Address.Zip = dto.Address.Zip;
foreach(var number in dto.Numbers)
{
contact.AddPhoneNumber(new PhoneNumber
{
Number = number.Number,
Type = number.Type
});
}
return contact;
}
示例5: Run
/// <summary>
/// Run the code example.
/// </summary>
/// <param name="user">The DFP user object running the code example.</param>
public override void Run(DfpUser user) {
// Get the ContactService.
ContactService contactService =
(ContactService) user.GetService(DfpService.v201508.ContactService);
// Set the IDs of the companies for the contacts.
long advertiserCompanyId = long.Parse(_T("INSERT_ADVERTISER_COMPANY_ID_HERE"));
long agencyCompanyId = long.Parse(_T("INSERT_AGENCY_COMPANY_ID_HERE"));
// Create an advertiser contact.
Contact advertiserContact = new Contact();
advertiserContact.name = "Mr. Advertiser #" + GetTimeStamp();
advertiserContact.email = "[email protected]";
advertiserContact.companyId = advertiserCompanyId;
// Create an agency contact.
Contact agencyContact = new Contact();
agencyContact.name = "Ms. Agency #" + GetTimeStamp();
agencyContact.email = "[email protected]";
agencyContact.companyId = agencyCompanyId;
try {
// Create the contacts on the server.
Contact[] contacts =
contactService.createContacts(new Contact[] {advertiserContact, agencyContact});
foreach (Contact contact in contacts) {
Console.WriteLine("A contact with ID \"{0}\" and name \"{1}\" was created.",
contact.id, contact.name);
}
} catch (Exception e) {
Console.WriteLine("Failed to create contacts. Exception says \"{0}\"", e.Message);
}
}
示例6: GetUserInfo
public Contact GetUserInfo()
{
WebInfo web = userCookie.Click("酷站</a> <a href=\"(?<key>.*?)\">更多</a><br/>", Encoding.UTF8);
web = web.Click("主题</a>[\\w\\W]*?<a href=\"(?<key>.*?)\">空间</a>", Encoding.UTF8);
web = web.Click("我的好友</a>\\|<a href=\"(?<key>.*?)\">我的档案</a>", Encoding.UTF8);
string html = web.Html;
Contact c = new Contact();
//头像
c.Photo = html.FindText("<div class=\"i\"><img src=\"", "\" alt=\"头像\"/>");
//姓名
c.Name = html.FindText("<strong>", "</strong>");
//昵称
c.NickName = this.UserName;
//性别
string str_sex = html.FindText("</strong><br/><br/>", "  ");
switch (str_sex)
{
case "男":
c.Sex = e_Sex.男;
break;
case "女":
c.Sex = e_Sex.女;
break;
default:
c.Sex = e_Sex.保密;
break;
}
//生日
c.BirthDay = html.FindText("  ", " ").ToDateTime();
//地址
Address a = new Address();
a.AddressType = e_AddressType.老家;
a.address = html.FindText("出生地:", "<br/>");
a.Country = "中国";
string[] arr_add = a.address.Split('-');
a.Province = arr_add[0];
if (arr_add.Length>1)
{
a.City = arr_add[1];
}
if (arr_add.Length>2)
{
a.District = arr_add[2];
}
c.Address = a;
c.Remark = html.FindText("个人简介:", "<br/>");
return c;
}
示例7: Main
static void Main(string[] args)
{
Uri baseAddress = new Uri("http://ncs-sz-jinnan:3721");
HttpClient httpClient = new HttpClient { BaseAddress = baseAddress };
IEnumerable<Contact> contacts = httpClient.GetAsync("/api/contacts").Result.Content.ReadAsAsync<IEnumerable<Contact>>().Result;
Console.WriteLine("当前联系人列表");
ListContacts(contacts);
Contact contact = new Contact { Id = "003", Name = "王五", EmailAddress = "[email protected]", PhoneNo = "789" };
Console.WriteLine("\n添加联系人003");
httpClient.PutAsync<Contact>("/api/contacts", contact, new JsonMediaTypeFormatter()).Wait();
contacts = httpClient.GetAsync("/api/contacts").Result.Content.ReadAsAsync<IEnumerable<Contact>>().Result;
ListContacts(contacts);
contact = new Contact { Id = "003", Name = "王五", EmailAddress = "[email protected]", PhoneNo = "987" };
Console.WriteLine("\n修改联系人003");
httpClient.PostAsync<Contact>("/api/contacts", contact, new XmlMediaTypeFormatter()).Wait();
contacts = httpClient.GetAsync("/api/contacts").Result.Content.ReadAsAsync<IEnumerable<Contact>>().Result;
ListContacts(contacts);
Console.WriteLine("\n删除联系人003");
httpClient.DeleteAsync("/api/contacts/003").Wait();
contacts = httpClient.GetAsync("/api/contacts").Result.Content.ReadAsAsync<IEnumerable<Contact>>().Result;
ListContacts(contacts);
Console.Read();
}
示例8: GetUser
public static Contact GetUser(Uri requestUri, int Id)
{
ClientContext context;
if (ClientContextUtilities.TryResolveClientContext(requestUri, out context, null))
{
using (context)
{
var web = context.Web;
context.Load(web);
var user = web.GetUserById(Id);
context.Load(user, u => u.LoginName);
context.ExecuteQuery();
var peopleManager = new PeopleManager(context);
var userProfile = peopleManager.GetPropertiesFor(user.LoginName);
context.Load(userProfile);
context.ExecuteQuery();
var contact = new Contact() { ExternalId = user.Id.ToString(), FullName = user.Title, EmailAddress = user.Email };
if (userProfile.IsPropertyAvailable("Title"))
contact.Position = userProfile.Title;
if (userProfile.IsPropertyAvailable("UserProfileProperties") && userProfile.UserProfileProperties.ContainsKey("WorkPhone"))
contact.PhoneNumber = userProfile.UserProfileProperties["WorkPhone"];
return contact;
}
}
throw new InvalidOperationException(string.Format("Unable to find user '{0}' at '{1}'", Id, requestUri.AbsoluteUri));
}
示例9: CreateReportFile
static public string CreateReportFile(Contact supplier, DateTime fromDate, DateTime toDate) {
DataView view = BillingDS.GetBills(fromDate, toDate, "[BillType] IN('B','G') AND [BillStatus] <> 'X' AND " +
"[CancelationTime] > '" + toDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
string fileContents = GetReportFileSection(view, "1", "I"); // Active bills
view = BillingDS.GetBills(DateTime.Parse("31/12/2011"), fromDate.AddSeconds(-0.5),
"[BillType] = 'B' AND [BillStatus] = 'C' AND [CancelationTime] >= '" + fromDate.ToString("yyyy-MM-dd") + "' AND " +
"[CancelationTime] <= '" + toDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
fileContents += GetReportFileSection(view, "0", "I"); // Canceled bills
view = BillingDS.GetBills(fromDate, toDate, "[BillType] IN ('C','L') AND [BillStatus] = 'A'");
fileContents += GetReportFileSection(view, "1", "E"); // Active credit notes
view = BillingDS.GetBills(DateTime.Parse("31/12/2011"), fromDate.AddSeconds(-0.5),
"[BillType] IN ('C','L') AND [BillStatus] = 'C' AND [CancelationTime] >= '" + fromDate.ToString("yyyy-MM-dd") + "' AND " +
"[CancelationTime] <= '" + toDate.ToString("yyyy-MM-dd HH:mm:ss") + "'");
fileContents += GetReportFileSection(view, "0", "E"); // Canceled credit notes
fileContents = fileContents.TrimEnd(System.Environment.NewLine.ToCharArray());
string fileName = GetReportFileName(toDate);
System.IO.File.WriteAllText(fileName, fileContents);
return fileName;
}
示例10: EditBusinessCriticality
public String EditBusinessCriticality(Contact contact)
{
db.Entry(contact).State = EntityState.Modified;
db.SaveChanges();
return "Success";
}
示例11: CreateAccount
public ResponseHolder CreateAccount(Account acc, Contact con)
{
acc.Status = "Draft";
ResponseHolder accResp = zs.Create(acc);
if (accResp.Success)
{
con.AccountId = accResp.Id;
ResponseHolder conResp = zs.Create(con);
if (conResp.Success)
{
Account newAcc = new Account();
newAcc.Id = accResp.Id;
newAcc.Status = "Active";
newAcc.SoldToId = conResp.Id;
newAcc.BillToId = conResp.Id;
return zs.Update(new List<zObject>{newAcc})[0];
}
else
{
return conResp;
}
}
else
{
return accResp;
}
}
示例12: DeleteBusinessCriticality
public String DeleteBusinessCriticality(Contact contact)
{
db.Contacts.Remove(contact);
db.SaveChanges();
return "Success";
}
示例13: CreateApplication
public String CreateApplication(Contact contact)
{
db.Contacts.Add(contact);
db.SaveChanges();
return "Success";
}
示例14: UpdateContact
public void UpdateContact(int contactId, Contact entity)
{
var contactManager = new ContactManager(this);
var originalContact = new Contact();
originalContact = contactManager.GetContact(contactId);
contactManager.Update(originalContact, entity);
}
示例15: AddContact
public JsonResult AddContact(string firstName, string middleName, string lastName, string email, string phone,
int contactGroupId)
{
var result = new ServiceResponse<Object>();
var contact = new Contact
{
FirstName = firstName,
MiddleName = middleName,
LastName = lastName,
Email = email,
Phone = phone,
ContactGroupId = contactGroupId
};
try
{
_contactService.AddContact(contact);
}
catch (Exception ex)
{
Trace.WriteLine("AddContact: " + ex.Message);
result.Message = ex.Message;
}
result.Result = GetAllGroupsResponse();
return JsonResponse(result);
}