Exemplo n.º 1
0
        protected void BtnSalvar_Click(object sender, EventArgs e)
        {
            if (txtnome.Text == "" || txtqtd.Text == "" || txtendereco.Text == "")
            {
                lblmsg.Text = "Preencha os campos!";
            }
            else
            {
                string nome            = txtnome.Text;
                string endereco        = txtendereco.Text;
                int    qtdfuncionarios = Convert.ToInt32(txtqtd.Text);

                TB_CADASTRO t = new TB_CADASTRO()
                {
                    NOME = nome, QTDFUNCIONARIOS = qtdfuncionarios, ENDERECO = endereco
                };
                EmpresaEntities contextEmpresa = new EmpresaEntities();

                string valor = Request.QueryString["idItem"];

                if (String.IsNullOrEmpty(valor))
                {
                    contextEmpresa.TB_CADASTRO.Add(t);
                    lblmsg.Text = "Registro Inserido!";
                    contextEmpresa.SaveChanges();
                    ServicoWCF.ServicoClient wcf = new ServicoWCF.ServicoClient();
                    GDdados.DataSource = wcf.Consultar("");
                    GDdados.DataBind();
                }
            }
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ServicoWCF.ServicoClient wcf = new ServicoWCF.ServicoClient();
     GDdados.DataSource = wcf.Consultar("");
     GDdados.DataBind();
 }