Exemplo n.º 1
0
        /// <summary>
        /// Tasto esecuzione procedura
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_esegui_Click(object sender, System.EventArgs e)
        {
            string IDRegistro        = string.Empty;
            string IDAmministrazione = string.Empty;
            string idCorrGlobUO      = string.Empty;
            string idCorrGlobRuolo   = string.Empty;
            string idGruppo          = string.Empty;
            string livelloRuolo      = string.Empty;
            bool   checkedExist      = false;
            int    countChecked      = 0;

            CheckBox spunta;

            Amministrazione.Manager.OrganigrammaManager theManager = new Amministrazione.Manager.OrganigrammaManager();
            DocsPaWR.EsitoOperazione esito = new SAAdminTool.DocsPaWR.EsitoOperazione();

            try
            {
                if (!this.VerificaUtConn(this.dg_registri.Items[0].Cells[2].Text))
                {
                    for (int i = 0; i < this.dg_registri.Items.Count; i++)
                    {
                        spunta = (CheckBox)dg_registri.Items[i].Cells[6].FindControl("Chk_registri");

                        if (spunta.Checked)
                        {
                            checkedExist = true;
                            countChecked++;

                            spunta.Enabled = false;
                            spunta.Checked = false;

                            IDRegistro        = this.dg_registri.Items[i].Cells[0].Text;
                            IDAmministrazione = this.dg_registri.Items[i].Cells[2].Text;
                            idCorrGlobUO      = this.dg_registri.Items[i].Cells[3].Text;
                            idCorrGlobRuolo   = this.dg_registri.Items[i].Cells[4].Text;
                            idGruppo          = this.dg_registri.Items[i].Cells[5].Text;

                            if (livelloRuolo.Equals(string.Empty))
                            {
                                livelloRuolo = theManager.GetLivelloRuolo(idCorrGlobRuolo);
                            }

                            theManager.EstendeVisibRuolo(IDRegistro, idCorrGlobRuolo, idGruppo, idCorrGlobUO, IDAmministrazione, livelloRuolo, cb_atipicita.Checked);
                            esito = theManager.getEsitoOperazione();

                            if (esito.Codice.Equals(0))
                            {
                                this.dg_registri.Items[i].Cells[7].Text = "<font color=green><b>OK</b></font>";
                            }
                            else
                            {
                                this.dg_registri.Items[i].Cells[7].Text = "<font color=red>" + esito.Descrizione + "</font>";
                            }
                        }
                        else
                        {
                            if (!spunta.Enabled)
                            {
                                countChecked++;
                            }
                        }
                    }
                }

                if (countChecked == this.dg_registri.Items.Count)
                {
                    this.btn_esegui.Visible = false;
                }

                if (checkedExist)
                {
                    this.btn_chiudi.Enabled = true;
                    this.btn_chiudi.Text    = "Chiudi";
                }
            }
            catch
            {
                this.GUI("ResetAll");
            }
        }