Esempio n. 1
0
    protected void OnBtnSaveClicked(object sender, EventArgs e)
    {
        ParamFormationRepository repo = new ParamFormationRepository();

        ParamFormation saveItem = new ParamFormation();
        saveItem.Label = txtStudyLabel.Text.Trim();

        if (string.IsNullOrEmpty(Request.QueryString["StudyID"]))
        {
            IList<ParamFormation> oldList = repo.GetAllParamFormations(saveItem.Label);
            if (oldList.Count > 0)
            {
                string message = ResourceManager.GetString("itemAlreadyExist");
                string script1 = "<script type=\"text/javascript\">";
                script1 += " alert(\"" + message + "\");";
                script1 += " </script>";

                if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
                    ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script1);
            }
            else
            {
                repo.Insert(saveItem);
            }
        }
        else
        {
            saveItem.FormationID = int.Parse(Request.QueryString["StudyID"]);
            repo.Update(saveItem);
        }

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

        if (!ClientScript.IsClientScriptBlockRegistered("redirectUser"))
            ClientScript.RegisterStartupScript(this.GetType(), "redirectUser", script);
    }
Esempio n. 2
0
    protected void OnStudyDeleteClicked(object sender, EventArgs e)
    {
        LinkButton lnkItem = (LinkButton)sender;
        int studyID = int.Parse(lnkItem.CommandArgument);

        ParamFormation deleteItem = new ParamFormation(studyID);
        ParamFormationRepository repo = new ParamFormationRepository();
        repo.Delete(deleteItem);

        BindGridData();
        gridStudy.DataBind();
    }