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

        ParamProfile saveItem = new ParamProfile();
        saveItem.Profile = txtProfile.Text.Trim();
        saveItem.ProfileCode = txtCode.Text.Trim();

        if (string.IsNullOrEmpty(Request.QueryString["ProfileID"]))
        {
            repo.Insert(saveItem);
        }
        else
        {
            saveItem.ProfileID = int.Parse(Request.QueryString["ProfileID"]);
            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 OnProfileDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        int profileID = int.Parse(lnkItem.CommandArgument);

        ParamProfile deleteItem = new ParamProfile(profileID);
        ParamProfileRepository repo = new ParamProfileRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridProfiles.DataBind();
    }