protected void OnBtnSaveClicked(object sender, EventArgs e)
    {
        ParamKnowledgeRepository repo = new ParamKnowledgeRepository();

        ParamKnowledge saveItem = new ParamKnowledge();
        saveItem.KnowledgeFamID = ddlKnowledgeFam.SelectedValue;
        saveItem.Code = txtCode.Text.Trim();
        saveItem.Definition = txtDefinition.Text.Trim();

        if (string.IsNullOrEmpty(Request.QueryString["KnowledgeID"]))
        {
            repo.Insert(saveItem);
        }
        else
        {
            saveItem.KnowledgeID = int.Parse(Request.QueryString["KnowledgeID"]);
            repo.Update(saveItem);
        }

        string script = "<script type=\"text/javascript\">";
        script += " OnBtnSaveClientClicked();";
        script += " </script>";

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
示例#2
0
    protected void OnKnowledgeDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        int knowledgeID = int.Parse(lnkItem.CommandArgument);

        ParamKnowledge deleteItem = new ParamKnowledge(knowledgeID);
        ParamKnowledgeRepository repo = new ParamKnowledgeRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridKnowledge.DataBind();
    }