예제 #1
0
        protected void btn_addContatore_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            switch (oggettoCustom.TIPO_CONTATORE)
            {
            case "T":
                if (dgContatori.Items.Count == 0)
                {
                    Contatore contatore = new Contatore();
                    contatore.ID_AOO       = "0";
                    contatore.ID_RF        = "0";
                    contatore.ANNO         = System.DateTime.Now.Year.ToString();
                    contatore.ID_OGG       = idOggetto;
                    contatore.ID_TIPOLOGIA = idTemplate;
                    contatore.ABILITATO    = "1";
                    contatore.VALORE       = "0";
                    contatore.VALORE_SC    = "0";

                    ProfilazioneDocManager.InsertValuesContatoreDoc(this, contatore);

                    contatori = ProfilazioneDocManager.GetValuesContatoriDoc(this, oggettoCustom);
                    caricaDgContatori();
                    impostaVisualizzazione();
                }
                break;

            case "A":
                if (!string.IsNullOrEmpty(((System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txt_systemIdAoo")).Value))
                {
                    Contatore contatore = new Contatore();
                    contatore.ID_AOO       = ((System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txt_systemIdAoo")).Value;
                    contatore.ID_RF        = "0";
                    contatore.ANNO         = System.DateTime.Now.Year.ToString();
                    contatore.ID_OGG       = idOggetto;
                    contatore.ID_TIPOLOGIA = idTemplate;
                    contatore.ABILITATO    = "1";
                    contatore.VALORE       = "0";
                    contatore.VALORE_SC    = "0";

                    ProfilazioneDocManager.InsertValuesContatoreDoc(this, contatore);

                    contatori = ProfilazioneDocManager.GetValuesContatoriDoc(this, oggettoCustom);
                    caricaDgContatori();
                    impostaVisualizzazione();
                }
                break;

            case "R":
                if (!string.IsNullOrEmpty(((System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txt_systemIdRF")).Value))
                {
                    Contatore contatore = new Contatore();
                    contatore.ID_RF        = ((System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txt_systemIdRF")).Value;
                    contatore.ID_AOO       = "0";
                    contatore.ANNO         = System.DateTime.Now.Year.ToString();
                    contatore.ID_OGG       = idOggetto;
                    contatore.ID_TIPOLOGIA = idTemplate;
                    contatore.ABILITATO    = "1";
                    contatore.VALORE       = "0";
                    contatore.VALORE_SC    = "0";

                    ProfilazioneDocManager.InsertValuesContatoreDoc(this, contatore);

                    contatori = ProfilazioneDocManager.GetValuesContatoriDoc(this, oggettoCustom);
                    caricaDgContatori();
                    impostaVisualizzazione();
                }
                break;
            }
        }