コード例 #1
0
        private void Transfor_and_Bind_DataSource(List <ARCHIVE_AUTH_Authorization> query)
        {
            //trasformo l'autorizzazione nel mio datasource per la griglia.
            List <ARCHIVE_AUTH_Authorization_Result> _dsource = new List <ARCHIVE_AUTH_Authorization_Result>();

            foreach (ARCHIVE_AUTH_Authorization _autAut in query)
            {
                Utente tempCorrSingle;
                tempCorrSingle = UserManager.GetUtenteByIdPeople(_autAut.People_ID.ToString());
                ARCHIVE_AUTH_Authorization_Result _result = new ARCHIVE_AUTH_Authorization_Result();
                _result.System_ID = (int)_autAut.System_ID;
                // _result.CodiceRubrica = tempCorrSingle.codiceRubrica;
                _result.DescrizioneRubrica = tempCorrSingle.descrizione;
                _result.DtaDecorrenza      = (DateTime)_autAut.StartDate;
                _result.DtaScadenza        = (DateTime)_autAut.EndDate;
                _dsource.Add(_result);
            }

            if (_dsource.Count > 0)
            {
                gvResultAUTH.DataSource = _dsource;
                gvResultAUTH.DataBind();
            }
            else
            {
                InitializeGridDatasource();
            }

            UpnlGrid.Update();
        }
コード例 #2
0
 protected void btnClearFilterUserInAuth_Click(object sender, EventArgs e)
 {
     ResetControlPage();
     upUtenteDetails.Update();
     upValidityTime.Update();
     upStateAuth.Update();
     UpnlGrid.Update();
     UpTranfetButtons.Update();
 }
コード例 #3
0
        protected void SearchAuthorization_Click(object sender, EventArgs e)
        {
            //INIZIO:
            bool FiltroIDAuthorization           = false;
            bool FiltroDtaDecorrezaAuthorization = false;
            bool FiltroDtaScadenzaAuthorization  = false;
            bool FiltroUtenteAuthorization       = false;

            if (!string.IsNullOrEmpty(this.idUserInAuth.Value))
            {
                FiltroUtenteAuthorization = true;
            }

            if (!string.IsNullOrEmpty(this.dtaDecorrenza_TxtFrom.Text))
            {
                FiltroDtaDecorrezaAuthorization = true;
            }

            if (!string.IsNullOrEmpty(this.dtaScadenza_TxtFrom.Text))
            {
                FiltroDtaScadenzaAuthorization = true;
            }

            if (!string.IsNullOrEmpty(this.TxtIdAutorizzazione.Text))
            {
                FiltroIDAuthorization = true;
            }

            //GetAll
            List <ARCHIVE_AUTH_Authorization> _lstOutput = UIManager.ArchiveManager.GetALLARCHIVE_Autorizations();
            //Ora la passo sotto linq:
            var query = _lstOutput.Where(x => x.System_ID != 0);

            if (FiltroIDAuthorization)
            {
                query = query.Where(x => x.System_ID == Convert.ToInt32(TxtIdAutorizzazione.Text.Trim()));
            }

            if (FiltroUtenteAuthorization)
            {
                query = query.Where(x => x.People_ID == Convert.ToInt32(idUserInAuth.Value.Trim()));
            }

            if (FiltroDtaDecorrezaAuthorization)
            {
                query = query.Where(x => x.StartDate >= Convert.ToDateTime(dtaDecorrenza_TxtFrom.Text.Trim()));
            }

            if (FiltroDtaScadenzaAuthorization)
            {
                query = query.Where(x => x.EndDate <= Convert.ToDateTime(dtaScadenza_TxtFrom.Text.Trim()));
            }

            switch (rblStateType.SelectedItem.Value)
            {
            //Attiva
            case "A":
                query = query.Where(x => x.EndDate >= DateTime.Now);
                break;

            //Scaduta
            case "S":
                query = query.Where(x => x.EndDate <= DateTime.Now);
                break;

            //Tutti
            case "T":
                break;
            }

            if (query.Count() > 0)
            {
                Transfor_and_Bind_DataSource(query.ToList());
            }
            else
            {
                InitializeGridDatasource();
            }

            UpnlGrid.Update();
        }