本文整理汇总了C#中Contacts.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Contacts.Add方法的具体用法?C# Contacts.Add怎么用?C# Contacts.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: lnkSave_Click
protected void lnkSave_Click(object sender, EventArgs e)
{
if (Session["mode"] != null)
{
if (Session["mode"] == "add")
{
try{
Contacts contacts = new Contacts();
contacts.FirstName = txtFirstName.Text;
contacts.LastName = txtLastName.Text;
contacts.Mobile = txtMobile.Text;
contacts.Landline = txtLandline.Text;
contacts.Email = txtEmail.Text;
contacts.Add();
Response.Redirect("Default.aspx");
}
catch(Exception ex)
{
lblMessage.Text = "Error in adding new contact." + Environment.NewLine + ex.Message;
}
}
else
{
try
{
Contacts contacts = new Contacts();
Int32 id = Convert.ToInt32(ViewState["id"].ToString());
contacts.GetContact(id);
contacts.FirstName = txtFirstName.Text;
contacts.LastName = txtLastName.Text;
contacts.Mobile = txtMobile.Text;
contacts.Landline = txtLandline.Text;
contacts.Email = txtEmail.Text;
contacts.Update();
Response.Redirect("Default.aspx");
}
catch(Exception ex)
{
lblMessage.Text = "Error in editing new contact." + Environment.NewLine + ex.Message;
}
}
}
}
示例2: vimeo_groups_getMembers
//.getMembers
public Contacts vimeo_groups_getMembers(string group_id, ChannelsSortMethods sortMethod=ChannelsSortMethods.Default, int? page=null, int? per_page=null)
{
var parameters = new Dictionary<string, string> { { "group_id", group_id } };
if (page.HasValue) parameters.Add("page", page.Value.ToString());
if (per_page.HasValue) parameters.Add("per_page", per_page.Value.ToString());
var x = ExecuteGetRequest("vimeo.groups.getMembers", parameters);
if (!IsResponseOK(x)) return null;
var e = x.Element("rsp").Element("members");
Contacts cs = new Contacts();
cs.on_this_page = int.Parse(e.Attribute("on_this_page").Value);
cs.page = int.Parse(e.Attribute("page").Value);
cs.perpage = int.Parse(e.Attribute("perpage").Value);
cs.total = int.Parse(e.Attribute("total").Value);
foreach (var item in e.Elements("member"))
{
cs.Add(Contact.FromElement(item));
}
return cs;
}