コード例 #1
0
        private void CarregarGridFerramentas()
        {
            FerramentaController frc   = new FerramentaController();
            List <Ferramenta>    lista = frc.Listar();

            gvFerramentas.DataSource = lista.OrderBy(c => c.Matricula);
            gvFerramentas.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CarregarGridFerramentas();

            if (!IsPostBack)
            {
                FerramentaController lc = new FerramentaController();
            }
        }
コード例 #3
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            Ferramenta f = new Ferramenta();

            f.Matricula = txtMatricula.Text;
            f.Diametro  = txtDiametro.Text;
            f.LoteId    = int.Parse(ddlLote.SelectedValue);

            FerramentaController fer = new FerramentaController();

            fer.Adicionar(f);

            txtMatricula.Text = "";
            txtDiametro.Text  = "";
        }
コード例 #4
0
        protected void btnExcluir_Click(object sender, EventArgs e)
        {
            FerramentaController fc  = new FerramentaController();
            Ferramenta           fer = fc.BuscarPorMatricula(int.Parse(txtRMatricula.Text));

            if (fer != null)
            {
                txtResultMatricula.Text = fer.Matricula;
                txtRDiametro.Text       = fer.Diametro;
                //Convert.ToInt32(txtRlote.Text) = fer.LoteId;
                fc.Excluir(fer);
            }
            LimparCampo();

            CarregarGridFerramentas();
        }
コード例 #5
0
        protected void btnBuscar_Click(object sender, EventArgs e)
        {
            FerramentaController fc  = new FerramentaController();
            Ferramenta           fer = fc.BuscarPorMatricula(int.Parse(txtRMatricula.Text));

            if (fer != null)
            {
                //txtRMatricula.Text = fer.Matricula;
                txtResultMatricula.Text = fer.Matricula;
                txtRDiametro.Text       = fer.Diametro;
                txtRlote.Text           = fer.LoteId.ToString();
                lblNExiste.Text         = string.Empty;
            }
            else
            {
                lblNExiste.Text = "* Ferramenta procurada não existe!!!";
                LimparCampo();
            }
        }
コード例 #6
0
        protected void btnAlterar_Click(object sender, EventArgs e)
        {
            FerramentaController fc  = new FerramentaController();
            Ferramenta           fer = fc.BuscarPorMatricula(int.Parse(txtRMatricula.Text));

            if (fer != null)
            {
                fer.Matricula = txtResultMatricula.Text;
                fer.Diametro  = txtRDiametro.Text;
                fer.LoteId    = int.Parse(txtRlote.Text);
                fc.Editar(fer);
                lblNExiste.Text = "* Ferramenta Alterada!!!";
            }
            else
            {
                lblNExiste.Text = "* Ferramenta procurada não existe!!!";
                LimparCampo();
            }

            CarregarGridFerramentas();
            // LimparCampo();
        }