using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class address_book_Insert : System.Web.UI.Page
{

    static String PAGINA_AGENDA = "Default.aspx";
    static String PAGINA_ERRO = "../Default.aspx";

    protected void Page_Load(object sender, EventArgs e)
    {
        tag_voltar.HRef = PAGINA_AGENDA;


    }
   

    protected void Button_Guardar_Click(object sender, EventArgs e)
    {
        try
        {
            decimal id_contacto = Convert.ToDecimal(Request.QueryString["id"]);
            DataClassesDataContext dc = new DataClassesDataContext();
            CONTACTO contacto = new CONTACTO();
            contacto.NOME = text_box_nome.Text;
            contacto.TIPO = text_box_tipo.Text;
            contacto.MORADA = text_box_morada.Text;
            contacto.NUMERO_TELEFONE_PRI = text_box_telefone.Text;
            contacto.NUMERO_FAX = text_box_fax.Text;
            contacto.EMAIL = text_box_email.Text;
            contacto.OBSERVACOES = text_box_observacoes.Text;

            dc.CONTACTOs.InsertOnSubmit(contacto);
            dc.SubmitChanges();

            mv.SetActiveView(v_success);
        }
        catch (Exception ex)
        {
            mv.SetActiveView(v_error);
        }   
    }


  
    protected void Button_Cancelar_Click(object sender, EventArgs e)
    {
        Response.Redirect(PAGINA_AGENDA);
    }
    

}
