/// <summary> /// Insert assertions /// </summary> private void InsertAssertion() { if (CheckValue()) // se supero i controlli sui valori immessi nel pannello asserzione, preparo l'oggetto asserzione da inserire { Assertion newAssertion = new Assertion(); newAssertion.ID_TYPE_EVENT = Convert.ToInt64(ddlTypeEvent.SelectedItem.Value); newAssertion.DESC_TYPE_EVENT = ddlTypeEvent.SelectedItem.Text; newAssertion.TYPE_AUR = ddlAur.SelectedItem.Value; if (newAssertion.TYPE_AUR.Equals(TYPE_AUR_ADMINISTRATION)) { newAssertion.ID_AUR = Convert.ToInt64(ID_ADMINISTRATION); newAssertion.DESC_AUR = CODE_ADMINISTRATION; } else { newAssertion.ID_AUR = Convert.ToInt64((GrdAssertionResult.SelectedRow.FindControl("lblSystemIdAggregator") as Label).Text); newAssertion.DESC_AUR = (GrdAssertionResult.SelectedRow.FindControl("lblCode") as Label).Text + "(" + (GrdAssertionResult.SelectedRow.FindControl("lblDescription") as Label).Text + ")"; } newAssertion.TYPE_NOTIFY = Convert.ToChar(rbTipologiaNotifica.SelectedItem.Value); newAssertion.IS_EXERCISE = cbInEsercizio.Checked; newAssertion.ID_AMM = Convert.ToInt64(ID_ADMINISTRATION); //chiamo il servizio di insert //0 - inserimento riuscito con successo //1 - l'asserzione è già presente //-1 - si è verificato un errore durante l'inserimento dell'asserzione. int valRet = ws.InsertAssertionEvent(newAssertion); if (valRet == 0) { //recupero le asserzioni dal backend Assertions = ws.GetListAssertion(ID_ADMINISTRATION).ToList(); //aggiorno la griglia delle asserzioni this.grid_rowindex.Value = "0"; BuildGrdAssertions(); MODE = "Modify"; BuildPanelAssertion(); GrdAssertionResult.DataSource = null; GrdAssertionResult.DataBind(); this.grdAssertionResult_rowindex.Value = "0"; pnlAssertion.Update(); UpdatePanelGridView.Update(); } else if (valRet == -1) { string s = "<script language='javascript'>alert('Si è verificato un errore durante l\\'inserimento dell\\'asserzione.');</script>"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "errorInsertAssertion", s, false); } else if (valRet == 1) { string s = "<script language='javascript'>alert('l\\'asserzione è già presente.');</script>"; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "duplicateAssertion", s, false); } } }