• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Contact类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Contact的典型用法代码示例。如果您正苦于以下问题:C# Contact类的具体用法?C# Contact怎么用?C# Contact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Contact类属于命名空间,在下文中一共展示了Contact类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
        }
开发者ID:weijunbao,项目名称:chatapp,代码行数:28,代码来源:EditContact.cs


示例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();
        }
开发者ID:treejames,项目名称:MESDemo,代码行数:25,代码来源:frmEditContact.cs


示例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();
        }
开发者ID:nviktor,项目名称:HSA_Maintanance,代码行数:26,代码来源:UserRepository.cs


示例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;
        }
开发者ID:Buthrakaur,项目名称:WpfModularApp,代码行数:26,代码来源:Map.cs


示例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);
      }
    }
开发者ID:markgmarkg,项目名称:googleads-dotnet-lib,代码行数:38,代码来源:CreateContacts.cs


示例6: GetUserInfo

        public Contact GetUserInfo()
        {
            WebInfo web = userCookie.Click("酷站</a>&nbsp;&nbsp;<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/>", "&#160;&#160;");
            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("&#160;&#160;", "&#160;").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;
        }
开发者ID:kuibono,项目名称:Voodoo-1,代码行数:60,代码来源:Baidu.cs


示例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();
    }
开发者ID:xiaohong2015,项目名称:.NET,代码行数:28,代码来源:Program.cs


示例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));
        }
开发者ID:beachandbytes,项目名称:GorillaDocs,代码行数:29,代码来源:SPUsers.cs


示例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;
    }
开发者ID:Ontica,项目名称:Empiria.Trade,代码行数:30,代码来源:XmlBill.cs


示例10: EditBusinessCriticality

        public String EditBusinessCriticality(Contact contact)
        {
            db.Entry(contact).State = EntityState.Modified;
            db.SaveChanges();

            return "Success";
        }
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:ContactRepository.cs


示例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;
            }
        }
开发者ID:zuorasc,项目名称:c-sharp-quickstart,代码行数:29,代码来源:AccountManager.cs


示例12: DeleteBusinessCriticality

        public String DeleteBusinessCriticality(Contact contact)
        {
            db.Contacts.Remove(contact);
            db.SaveChanges();

            return "Success";
        }
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:ContactRepository.cs


示例13: CreateApplication

        public String CreateApplication(Contact contact)
        {
            db.Contacts.Add(contact);
            db.SaveChanges();

            return "Success";
        }
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:ContactRepository.cs


示例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);
 }
开发者ID:sidneylimafilho,项目名称:InfoControl,代码行数:7,代码来源:CustomerManager.extender.cs


示例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);
        }
开发者ID:programulya,项目名称:Contacts,代码行数:30,代码来源:HomeController.cs


示例16: PutContact

        // PUT api/Contacts/5
        public HttpResponseMessage PutContact(int id, Contact contact)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != contact.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(contact).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
开发者ID:panatale1,项目名称:CPS593.NET,代码行数:26,代码来源:ContactsController.cs


示例17: ComposeBubble

 public ComposeBubble(long time, BubbleDirection direction, Service service, 
     VisualBubble bubbleToSend, Contact.ID[] ids) 
     : base(time, direction, service)
 {
     Ids = ids;
     BubbleToSend = bubbleToSend;
 }
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:7,代码来源:ComposeBubble.cs


示例18: HomeModule

 public HomeModule()
 {
     Get["/"] = _ => {
     return View["index.cshtml"];
       };
       Get["/view"] = _ => {
     List<Contact> cList = Contact.GetAllContacts();
     return View["view.cshtml",cList];
       };
       Get["/add"] = _ => {
     return View["add.cshtml"];
       };
       Post["/contact_created"] = _ => {
     Contact c = new Contact(Request.Form["new-name"],Request.Form["new-address"],Request.Form["new-number"]);
     return View["contact_created.cshtml", c];
       };
       Post["/contacts_deleted"] = _ => {
     Contact.DeleteAllContacts();
     List<Contact> cList = Contact.GetAllContacts();
     return View["view.cshtml", cList];
       };
       Get["/view/{name}"] = parameters => {
     Contact c = Contact.GetContactByName(parameters.name);
     return View["contact.cshtml", c];
       };
 }
开发者ID:CallanMcNulty,项目名称:address-book,代码行数:26,代码来源:HomeModule.cs


示例19: Contact

        public ActionResult Contact(ContactViewModel contactVm)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return View(contactVm);
                }

                var contact = new Contact
                {
                    From = contactVm.From,
                    Message = contactVm.Message
                };

                new Email().Send(contact);

                switch (Request.CurrentLang())
                {
                    case Lang.De:
                        return RedirectToAction("Danke");
                    case Lang.Nl:
                        return RedirectToAction("Bedankt");
                    case Lang.En:
                        return RedirectToAction("Thanks");
                    default:
                        return RedirectToAction("Tack");
                }
            }
            catch (Exception)
            {
                return RedirectToAction("Error");
            }
        }
开发者ID:Wigren,项目名称:Wermlands-Stugservice,代码行数:34,代码来源:ControllerBase.cs


示例20: Save

 public void Save(Contact contact, List<Friend> friends)
 {
     friends =
         friends.Where(friend => friend.ContactID1 != friend.ContactId2 && friend.ContactId2 == contact.Id).
             ToList();
     DAL.Save(contact, friends);
 }
开发者ID:juangdiaz,项目名称:NYU-CourseWork,代码行数:7,代码来源:FriendBUS.cs



注:本文中的Contact类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ContactData类代码示例发布时间:2022-05-24
下一篇:
C# ContaPolizaDetalle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap