Exemplo n.º 1
0
    protected void btnAddCategory_Click(object sender, EventArgs e)
    {
        ErrorControl1.ClearError();
        ErrorControl2.ClearError();
        ErrorControl1.ClearControls(divForm);

        divForm.Visible = true;
        divList.Visible = false;

        lblInstitution.Text     = "Add Category";
        BtnSave.Text            = "Add Category";
        BtnCancel.Visible       = true;
        BtnSave.Visible         = true;
        BtnSave.CommandArgument = "1";
    }
Exemplo n.º 2
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            LinkButton viewLinkBtn = (LinkButton)sender;
            var        stockId     = int.Parse(viewLinkBtn.CommandArgument);
            ErrorControl1.ClearError();
            ErrorControl2.ClearError();
            var insObj = _db.Stocks.FirstOrDefault(m => m.StockID == stockId);

            if (insObj != null)
            {
                _db.Stocks.Remove(insObj);
                _db.SaveChanges();
                LoadStock();
            }
        }
        catch (Exception ex)
        {
        }
    }