示例#1
0
    protected void btnRemove_Click(object sender, EventArgs e)
    {
        try
        {
            int    id  = -1;
            string _id = Request.QueryString["id"].ToString();
            int.TryParse(_id, out id);
            int userId = CurrentEnvironment.LoggedUser.Id;
            int i      = 0;
            if (id != 1 && id != 2 && id != 3)
            {
                i = ItemCategory.Remove(id);
            }

            if (i > 0)
            {
                lblSuccess.Visible = true;
                lblWarning.Visible = false;
                lblError.Visible   = false;
                gvItemCategory.DataBind();
                ClearControls(this);
            }
            else
            {
                lblSuccess.Visible = false;
                lblWarning.Visible = false;
                lblError.Visible   = true;
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }