本文整理汇总了C#中Contacts.GetContact方法的典型用法代码示例。如果您正苦于以下问题:C# Contacts.GetContact方法的具体用法?C# Contacts.GetContact怎么用?C# Contacts.GetContact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Contacts
的用法示例。
在下文中一共展示了Contacts.GetContact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
public dynamic Find(int id)
{
//var table = new Contacts();
//return table.Single(key: id);
dynamic table = new Contacts();
return table.GetContact(Id: id);
}
示例2: 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;
}
}
}
}
示例3: RowDeleting
protected void RowDeleting(Object sender, GridViewDeleteEventArgs e)
{
Contacts contacts = new Contacts();
Int32 id = Convert.ToInt32(grvContacts.DataKeys[e.RowIndex].Value.ToString());
contacts.GetContact(id);
contacts.Delete();
Response.Redirect("Default.aspx");
}
示例4: RowEditing
protected void RowEditing(Object sender, GridViewEditEventArgs e)
{
pnlContactsEntry.Visible = true;
lnkAdd.Visible = false;
Contacts contacts = new Contacts();
Int32 id = Convert.ToInt32(grvContacts.DataKeys[e.NewEditIndex].Value.ToString());
contacts.GetContact(id);
txtFirstName.Text = contacts.FirstName;
txtLastName.Text = contacts.LastName;
txtMobile.Text = contacts.Mobile;
txtLandline.Text = contacts.Landline;
txtEmail.Text = contacts.Email;
ViewState["id"] = id;
Session["mode"] = "edit";
}