Пример #1
0
        public void BuscarFabricantes()
        {
            FabricanteBLL fabricantesBLL = new FabricanteBLL();

            dtlFabricantes.DataSource = fabricantesBLL.GetAll();
            dtlFabricantes.DataBind();
        }
Пример #2
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (TxtIdFabricante.Text != string.Empty)
            {
                AtualizarFabricante();
            }
            else
            {
                if (txtNomeFabricante == null || txtNomeFabricante.Text.Length < 3)
                {
                    Util.showMessage(Page, "O Campo Fabricante não pode estar vazio ou conter menos de 3 caracteres, favor digite o nome corretamente");
                }
                else
                {
                    fabricante.NOME = txtNomeFabricante.Text;
                    fabricanteBLL.Add(fabricante);
                    fabricanteBLL.SaveChanges();

                    ListarFabricantes();

                    Util.showMessage(Page, "Fabricante salva com sucesso!");

                    fabricante    = null;
                    fabricanteBLL = null;
                    LimparCampos();
                }
            }
        }
Пример #3
0
        public void BuscarFabricantes()
        {
            FabricanteBLL fabricanteBLL = new FabricanteBLL();

            dtlFabricantes.DataSource = fabricanteBLL.getAll();
            dtlFabricantes.DataBind();
        }
Пример #4
0
        protected void GrvFabricantes_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            idFabricante = int.Parse(GrvFabricantes.DataKeys[e.RowIndex].Value.ToString());

            fabricante = fabricantes.Find(c => c.IDT_FABRICANTE == idFabricante).First <FABRICANTE>();

            fabricantes.Delete(fabricante);
            fabricantes.SaveChanges();

            fabricante    = null;
            fabricanteBLL = null;

            ListarFabricantes();
        }
Пример #5
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            if (txtIdFabricante.Text != string.Empty)
            {
                AtualizarFabricante();
            }
            else
            {
                fabricante.NOME = txtFabricante.Text;

                fabricantesBLL.Add(fabricante);
                fabricantesBLL.SaveChanges();

                BuscarFabricantes();

                fabricantesBLL = null;
                fabricante = null;
                LimparCampos();
            }
        }