protected void btGravar_Click(object sender, EventArgs e)
        {
            Customer cst = new Customer();

            cst.Nome = txtNome.Text;
            cst.Telefone = txtTel.Text;
            cst.Endereco = txtEnd.Text;
            cst.Bairro = txtBairro.Text;
            cst.Numero = int.Parse(txtNum.Text);
            cst.Complemento = txtComp.Text;
            cst.Obs = txtObs.Text;

            cst.AddCustomer();

            DataTable dt = new DataTable();
            dt = cst.GetCustomerByNumber(txtTel.Text);

            if (dt != null)
            {
                if (dt.Rows.Count > 0) 
                {
                    Session["NewCustomerHandler"] = dt.Rows[0].ItemArray[0].ToString();
                }
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseScript", "window.close()", true);
        }
Beispiel #2
0
        protected void btGravar_Click(object sender, EventArgs e)
        {
            Customer cst = new Customer();

            cst.Nome = txtNome.Text;
            cst.Telefone = txtTel.Text;
            cst.Endereco = txtEnd.Text;
            cst.Bairro = txtBairro.Text;
            cst.Numero = int.Parse(txtNum.Text);
            cst.Complemento = txtComp.Text;
            cst.Obs = txtObs.Text;

            cst.AddCustomer();

            txtNome.Text = "";
            txtTel.Text = "";
            txtEnd.Text = "";
            txtBairro.Text = "";
            txtNum.Text = "";
            txtComp.Text = "";
            txtObs.Text = "";
            lblStatus.Text = "Cadastrado com sucesso !";
        }