Esempio n. 1
0
        protected void grvFabricantes_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            idFabricante = int.Parse(grvFabricantes.DataKeys[e.RowIndex].Value.ToString());

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

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

            fabricantes = null;
            fabricante = null;

            BuscarFabricantes();
        }
Esempio n. 2
0
        public void AtualizarFabricante()
        {
            idFabricante = int.Parse(txtIdFabricante.Text);

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

            fabricante.NOME = txtFabricante.Text;

            fabricantes.Update(fabricante);
            fabricantes.SaveChanges();

            BuscarFabricantes();

            fabricantes = null;
            fabricante = null;
            LimparCampos();
        }
Esempio n. 3
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();
            }
        }
Esempio n. 4
0
        protected void grvFabricantes_SelectedIndexChanged(object sender, EventArgs e)
        {
            btnSalvar.Text = "Atualizar";

            idFabricante = (int)grvFabricantes.SelectedValue;

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

            txtIdFabricante.Text = fabricante.IDT_FABRICANTE.ToString();
            txtFabricante.Text = fabricante.NOME;

            fabricantes = null;
            fabricante = null;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the FABRICANTE EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToFABRICANTE(FABRICANTE fABRICANTE)
 {
     base.AddObject("FABRICANTE", fABRICANTE);
 }
 /// <summary>
 /// Create a new FABRICANTE object.
 /// </summary>
 /// <param name="iDT_FABRICANTE">Initial value of the IDT_FABRICANTE property.</param>
 public static FABRICANTE CreateFABRICANTE(global::System.Int32 iDT_FABRICANTE)
 {
     FABRICANTE fABRICANTE = new FABRICANTE();
     fABRICANTE.IDT_FABRICANTE = iDT_FABRICANTE;
     return fABRICANTE;
 }