示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        private void DataGridEsegui_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            S_Controls.S_ComboBox cmbFunzioni      = ((S_Controls.S_ComboBox)e.Item.FindControl("ddlFunzione"));
            S_Controls.S_CheckBox ckbLettura       = ((S_Controls.S_CheckBox)e.Item.FindControl("ckbLetturaEdit"));
            S_Controls.S_CheckBox ckbInserimento   = ((S_Controls.S_CheckBox)e.Item.FindControl("ckbInserimentoEdit"));
            S_Controls.S_CheckBox ckbModifica      = ((S_Controls.S_CheckBox)e.Item.FindControl("ckbModificaEdit"));
            S_Controls.S_CheckBox ckbCancellazione = ((S_Controls.S_CheckBox)e.Item.FindControl("ckbCancellazioneEdit"));

            int id = int.Parse(DataGridEsegui.DataKeys[(int)e.Item.ItemIndex].ToString());

            try
            {
                int i_Result = this.ExecuteRuoliFunzioni(id, Classi.ExecuteType.Update,
                                                         cmbFunzioni, ckbLettura, ckbInserimento, ckbModifica, ckbCancellazione);

                if (i_Result > 0)
                {
                    this.lblMessage.Text = "Associazione Ruolo - Modifica Eseguita correttamente";
                    lblMessage.CssClass  = "";
                    this.DataGridEsegui.EditItemIndex = -1;
                    this.BindGrid();
                    this.DataGridEsegui.Columns[1].Visible = true;
                    this.DataGridEsegui.Columns[2].Visible = false;
                    this.DataGridEsegui.Columns[3].Visible = false;
                }
                else
                {
                    lblMessage.Text     = "Associazione Ruolo - Modifica non eseguita";
                    lblMessage.CssClass = "LabelErrore";
                    this.DataGridEsegui.Columns[1].Visible = false;
                    this.DataGridEsegui.Columns[2].Visible = true;
                    this.DataGridEsegui.Columns[3].Visible = false;
                }
            }
            catch
            {
                string s_Err = "Errore: Associazione Ruolo non riuscita";
                PanelMess.ShowError(s_Err, true);
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="Operazione"></param>
        /// <param name="cmbFunzioni"></param>
        /// <param name="ckbLettura"></param>
        /// <param name="ckbInserimento"></param>
        /// <param name="ckbModifica"></param>
        /// <param name="ckbCancellazione"></param>
        /// <returns></returns>
        private int ExecuteRuoliFunzioni(int id, Classi.ExecuteType Operazione, S_Controls.S_ComboBox cmbFunzioni,
                                         S_Controls.S_CheckBox ckbLettura, S_Controls.S_CheckBox ckbInserimento,
                                         S_Controls.S_CheckBox ckbModifica, S_Controls.S_CheckBox ckbCancellazione)
        {
            int i_Result = 0;

            Classi.Ruolo _Ruolo = new TheSite.Classi.Ruolo();

            S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();

            S_Controls.Collections.S_Object s_Id = new S_Controls.Collections.S_Object();
            s_Id.ParameterName = "p_Funzione_Ruoli_Id";
            s_Id.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_Id.Direction     = ParameterDirection.Input;
            s_Id.Index         = 0;
            s_Id.Value         = id;

            S_Controls.Collections.S_Object s_FunzioneId = new S_Controls.Collections.S_Object();
            s_FunzioneId.ParameterName = "p_Funzione_Id";
            s_FunzioneId.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_FunzioneId.Direction     = ParameterDirection.Input;
            s_FunzioneId.Index         = 1;
            if (cmbFunzioni != null)
            {
                s_FunzioneId.Value = cmbFunzioni.SelectedValue;
            }
            else
            {
                s_FunzioneId.Value = DBNull.Value;
            }

            S_Controls.Collections.S_Object s_RuoloId = new S_Controls.Collections.S_Object();
            s_RuoloId.ParameterName = "p_Ruolo_Id";
            s_RuoloId.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_RuoloId.Direction     = ParameterDirection.Input;
            s_RuoloId.Index         = 2;
            s_RuoloId.Value         = itemId;;

            S_Controls.Collections.S_Object s_Lettura = new S_Controls.Collections.S_Object();
            s_Lettura.ParameterName = "p_Lettura";
            s_Lettura.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_Lettura.Direction     = ParameterDirection.Input;
            s_Lettura.Index         = 3;
            if (ckbLettura != null)
            {
                s_Lettura.Value = Convert.ToInt32(ckbLettura.Checked) * (-1);
            }
            else
            {
                s_Lettura.Value = DBNull.Value;
            }

            S_Controls.Collections.S_Object s_Inserimento = new S_Controls.Collections.S_Object();
            s_Inserimento.ParameterName = "p_Inserimento";
            s_Inserimento.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_Inserimento.Direction     = ParameterDirection.Input;
            s_Inserimento.Index         = 4;
            if (ckbLettura != null)
            {
                s_Inserimento.Value = Convert.ToInt32(ckbInserimento.Checked) * (-1);
            }
            else
            {
                s_Inserimento.Value = DBNull.Value;
            }


            S_Controls.Collections.S_Object s_Modifica = new S_Controls.Collections.S_Object();
            s_Modifica.ParameterName = "p_Modifica";
            s_Modifica.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_Modifica.Direction     = ParameterDirection.Input;
            s_Modifica.Index         = 5;
            if (ckbLettura != null)
            {
                s_Modifica.Value = Convert.ToInt32(ckbModifica.Checked) * (-1);
            }
            else
            {
                s_Modifica.Value = DBNull.Value;
            }

            S_Controls.Collections.S_Object s_Cancellazione = new S_Controls.Collections.S_Object();
            s_Cancellazione.ParameterName = "p_Cancellazione";
            s_Cancellazione.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
            s_Cancellazione.Direction     = ParameterDirection.Input;
            s_Cancellazione.Index         = 6;
            if (ckbLettura != null)
            {
                s_Cancellazione.Value = Convert.ToInt32(ckbCancellazione.Checked) * (-1);
            }
            else
            {
                s_Cancellazione.Value = DBNull.Value;
            }

            _SCollection.Add(s_Id);
            _SCollection.Add(s_FunzioneId);
            _SCollection.Add(s_RuoloId);
            _SCollection.Add(s_Lettura);
            _SCollection.Add(s_Inserimento);
            _SCollection.Add(s_Modifica);
            _SCollection.Add(s_Cancellazione);

            try
            {
                i_Result = _Ruolo.UpdateFunzioni(_SCollection, Operazione);
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
                i_Result = 0;
            }

            return(i_Result);
        }