Exemplo n.º 1
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            if (CpfCnpjValid(txtCpf.Text))
            {
                sendMessage("CPF Valido");
            }
            else
            {
                sendMessage("CPF Invalido");
                return;
            }

            Cliente cliente = new Cliente()
            {
                nome     = txtNome.Text,
                telefone = txtTelefone.Text,
                cidade   = txtCidade.Text,
                endereco = txtEndereco.Text,
                cpf      = txtCpf.Text
            };

            context.Cliente.Add(cliente);
            context.SaveChanges();
            loadGrid();
        }
Exemplo n.º 2
0
        private void loadGrid()
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            GVTipo.DataSource = context.Tipo.ToList <Tipo>();
            GVTipo.DataBind();
        }
Exemplo n.º 3
0
        private void loadGrid()
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            GVClientes.DataSource = context.Cliente.ToList <Cliente>();
            GVClientes.DataBind();
        }
Exemplo n.º 4
0
        private void loadGrid()
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            GVMaterial.DataSource = context.Material.ToList <Material>();
            GVMaterial.DataBind();
        }
Exemplo n.º 5
0
        private void loadGrid()
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            GVFornecedor.DataSource = context.Fornecedor.ToList <Fornecedor>();
            GVFornecedor.DataBind();
        }
Exemplo n.º 6
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            if (CpfCnpjValid(txtCnpj.Text))
            {
                sendMessage("CNPJ Valido");
            }
            else
            {
                sendMessage("CNPJ Invalido");
                return;
            }

            Fornecedor fornecedor = new Fornecedor()
            {
                nome     = txtNome.Text,
                telefone = txtTelefone.Text,
                cidade   = txtCidade.Text,
                endereco = txtEndereco.Text,
                cnpj     = txtCnpj.Text
            };

            context.Fornecedor.Add(fornecedor);
            context.SaveChanges();
            loadGrid();
        }
Exemplo n.º 7
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            Tipo tipo = new Tipo()
            {
                descricao = txtDescricao.Text
            };

            context.Tipo.Add(tipo);
            context.SaveChanges();
            loadGrid();
        }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CpfCnpjEntities1 context = new CpfCnpjEntities1();
         txtTipo.DataSource     = context.Tipo.ToList <Tipo>();
         txtTipo.DataTextField  = "Descricao";
         txtTipo.DataValueField = "Id";
         txtTipo.DataBind();
         txtFornecedor.DataSource     = context.Fornecedor.ToList <Fornecedor>();
         txtFornecedor.DataTextField  = "Nome";
         txtFornecedor.DataValueField = "Id";
         txtFornecedor.DataBind();
         loadGrid();
     }
 }
Exemplo n.º 9
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            CpfCnpjEntities1 context = new CpfCnpjEntities1();

            Material material = new Material()
            {
                descricao   = txtDescricao.Text,
                dataEntrada = DateTime.UtcNow,
                tipo        = int.Parse(txtTipo.SelectedValue.ToString()),
                valor       = int.Parse(txtValor.Text),
                fornecedor  = int.Parse(txtFornecedor.SelectedValue.ToString())
            };

            context.Material.Add(material);
            context.SaveChanges();
            loadGrid();
            sendMessage("Registro Inserido");
        }