示例#1
0
        public List <ModelloDelega> searchModelliDelegaPaging(DocsPaVO.utente.InfoUtente utente, List <Ruolo> ruoli, SearchModelloDelegaInfo searchInfo, SearchPagingContext pagingContext)
        {
            string idPeople   = utente.idPeople;
            string conditions = buildConditions(searchInfo);
            Dictionary <string, string> paramList = new Dictionary <string, string>();

            paramList.Add("idUtente", idPeople);
            paramList.Add("param1", conditions);
            PagingQuery pagingQuery = new PagingQuery("S_COUNT_MODELLI_DELEGA", "S_GET_MODELLI_DELEGA_PAGING", pagingContext, paramList);
            string      commandText = pagingQuery.Query.getSQL();

            logger.Debug("QUERY : " + commandText);
            DataSet ds = new DataSet();

            ExecuteQuery(ds, commandText);
            List <ModelloDelega> res = new List <ModelloDelega>();

            if (ds.Tables[0].Rows.Count != 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ModelloDelega temp = buildModelloDelega(ds.Tables[0].Rows[i], ruoli);
                    res.Add(temp);
                }
            }
            return(res);
        }
示例#2
0
        public List <ModelloDelega> searchModelliDelega(DocsPaVO.utente.InfoUtente utente, List <Ruolo> ruoli, SearchModelloDelegaInfo searchInfo)
        {
            string idPeople = utente.idPeople;

            DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("S_GET_MODELLI_DELEGA");
            queryMng.setParam("idUtente", idPeople);
            string condRicerca = buildConditions(searchInfo);

            queryMng.setParam("param1", condRicerca);
            string commandText = queryMng.getSQL();

            logger.Debug("QUERY : " + commandText);
            DataSet ds = new DataSet();

            ExecuteQuery(ds, commandText);
            List <ModelloDelega> res = new List <ModelloDelega>();

            if (ds.Tables[0].Rows.Count != 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    ModelloDelega temp = buildModelloDelega(ds.Tables[0].Rows[i], ruoli);
                    res.Add(temp);
                }
            }
            return(res);
        }
示例#3
0
        private ModelloDelega buildModelloDelega(DataRow row, List <Ruolo> ruoli)
        {
            ModelloDelega res = new ModelloDelega(ruoli);

            if (row["DTA_INIZIO"].GetType() != typeof(DBNull))
            {
                Type tp = row["DTA_INIZIO"].GetType();
                res.DataInizio = (DateTime)row["DTA_INIZIO"];
            }
            if (row["DTA_FINE"].GetType() != typeof(DBNull))
            {
                res.DataFine = (DateTime)row["DTA_FINE"];
            }
            res.Id = row["SYSTEM_ID"].ToString();
            res.IdUtenteDelegante = row["ID_PEOPLE_DELEGANTE"].ToString();
            if (row["ID_RUOLO_DELEGANTE"].GetType() != typeof(DBNull))
            {
                res.IdRuoloDelegante = row["ID_RUOLO_DELEGANTE"].ToString();
            }
            res.DescrRuoloDelegante = row["VAR_DESC_CORR"].ToString();
            res.IdUtenteDelegato    = row["ID_PEOPLE_DELEGATO"].ToString();
            res.IdRuoloDelegato     = row["ID_RUOLO_DELEGATO"].ToString();
            if (row["INTERVALLO"].GetType() != typeof(DBNull))
            {
                res.Intervallo = Int32.Parse(row["INTERVALLO"].ToString());
            }
            res.Nome = row["NOME"].ToString();
            res.DescrUtenteDelegato = row["FULL_NAME"].ToString();
            return(res);
        }
示例#4
0
        public static InfoDelega buildDelegaFromModello(DocsPaVO.utente.InfoUtente utente, string idModello, DateTime overrideDataInizio, DateTime overrideDataFine)
        {
            ModDeleghe    modDeleghe = new ModDeleghe();
            ModelloDelega md         = modDeleghe.getModelloDelegaById(idModello);
            InfoDelega    delega     = new InfoDelega();

            if (string.IsNullOrEmpty(md.IdRuoloDelegante))
            {
                delega.id_ruolo_delegante  = "0";
                delega.cod_ruolo_delegante = "TUTTI";
            }
            else
            {
                delega.id_ruolo_delegante  = md.IdRuoloDelegante;
                delega.cod_ruolo_delegante = md.DescrRuoloDelegante;
            }
            delega.id_utente_delegante = utente.idPeople;
            Corrispondente delegante = UserManager.getCorrispondenteByIdPeople(utente.idPeople, TipoUtente.INTERNO, utente);

            delega.cod_utente_delegante = delegante.codiceRubrica;
            delega.id_ruolo_delegato    = md.IdRuoloDelegato;

            Corrispondente delegato = BusinessLogic.Utenti.UserManager.getCorrispondenteBySystemID(md.IdUtenteDelegato);

            delega.cod_utente_delegato = delegato.codiceRubrica;
            md.IdUtenteDelegato        = ((DocsPaVO.utente.Utente)(delegato)).idPeople;

            ArrayList ruoliDelegato = BusinessLogic.Utenti.UserManager.getRuoliUtente(md.IdUtenteDelegato);

            ruoliDelegato.Sort(new RuoliComparer());
            delega.id_uo_delegato = ((Ruolo)ruoliDelegato[0]).uo.systemId;


            Ruolo ruoloDelegato = UserManager.getRuoloById(md.IdRuoloDelegato);

            delega.cod_ruolo_delegato  = ruoloDelegato.codice;
            delega.id_utente_delegato  = md.IdUtenteDelegato;
            delega.cod_utente_delegato = null;
            if (overrideDataInizio.CompareTo(DateTime.MinValue) > 0)
            {
                delega.dataDecorrenza = buildDateString(overrideDataInizio);
            }
            else
            {
                delega.dataDecorrenza = buildDateString(md.DataInizioDelega);
            }
            if (overrideDataFine.CompareTo(DateTime.MinValue) > 0)
            {
                delega.dataScadenza = buildDateString(overrideDataFine);
            }
            else
            {
                delega.dataScadenza = buildDateString(md.DataFineDelega);
            }
            return(delega);
        }
示例#5
0
 public static bool ModificaModelloDelega(ModelloDelega modDel, Page page)
 {
     try
     {
         return(docsPaWS.UpdateModelloDelega(modDel));
     }
     catch (Exception e)
     {
         ErrorManager.redirect(page, e);
     }
     return(false);
 }
示例#6
0
 public static bool CreaNuovoModelloDelega(ModelloDelega modDel, Page page)
 {
     try
     {
         return(docsPaWS.InsertModelloDelega(modDel));
     }
     catch (Exception es)
     {
         ErrorManager.redirect(page, es);
     }
     return(false);
 }
示例#7
0
        public bool insertModelloDelega(ModelloDelega modelloDelega)
        {
            bool result = true;

            try
            {
                string insertList = modelloDelega.IdUtenteDelegante + ",";
                if (!string.IsNullOrEmpty(modelloDelega.IdRuoloDelegante))
                {
                    insertList += modelloDelega.IdRuoloDelegante + ",";
                }
                else
                {
                    insertList += "NULL,";
                }
                insertList += modelloDelega.IdUtenteDelegato + ",";
                insertList += modelloDelega.IdRuoloDelegato + ",";
                insertList += getToDate(modelloDelega.DataInizio, DATE_FORMAT) + ",";
                insertList += getToDate(modelloDelega.DataFine, DATE_FORMAT) + ",";
                insertList += modelloDelega.Intervallo + ",";
                insertList += "'" + modelloDelega.Nome.Replace("'", "''") + "'";
                Query q = DocsPaUtils.InitQuery.getInstance().getQuery("I_INSERT_MODELLO_DELEGA");
                q.setParam("colId", DocsPaDbManagement.Functions.Functions.GetSystemIdColName());
                q.setParam("id", DocsPaDbManagement.Functions.Functions.GetSystemIdNextVal(""));
                q.setParam("insertList", insertList);
                string queryString = q.getSQL();
                logger.Debug("Inserimento nuovo modello di delega: ");
                logger.Debug(queryString);
                if (!ExecuteNonQuery(queryString))
                {
                    result = false;
                    RollbackTransaction();
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                result = false;
                logger.Debug(e.Message);
            }
            return(result);
        }
示例#8
0
        public ModelloDelega getModelloDelegaById(string idModello)
        {
            DocsPaUtils.Query queryMng = DocsPaUtils.InitQuery.getInstance().getQuery("S_GET_MODELLI_DELEGA_BY_ID");
            queryMng.setParam("idModello", idModello);
            string commandText = queryMng.getSQL();

            logger.Debug("QUERY : " + commandText);
            DataSet ds = new DataSet();

            ExecuteQuery(ds, commandText);
            if (ds.Tables[0].Rows.Count != 0)
            {
                ModelloDelega temp = buildModelloDelega(ds.Tables[0].Rows[0], null);
                return(temp);
            }
            else
            {
                return(null);
            }
        }
示例#9
0
        public static ModelloDelegaInfo buildInstance(ModelloDelega input)
        {
            ModelloDelegaInfo res = new ModelloDelegaInfo();

            res.Id               = input.Id;
            res.Nome             = input.Nome;
            res.DataInizioDelega = input.DataInizioDelega;
            res.DataFineDelega   = input.DataFineDelega;
            if (input.DescrRuoloDelegante.Length > 0)
            {
                res.DescrRuoloDelegante = input.DescrRuoloDelegante;
            }
            else
            {
                res.DescrRuoloDelegante = "Tutti";
            }

            res.DescrUtenteDelegato = input.DescrUtenteDelegato;
            return(res);
        }
示例#10
0
        public bool updateModelloDelega(ModelloDelega modelloDelega)
        {
            bool result = true;

            try
            {
                Query q = DocsPaUtils.InitQuery.getInstance().getQuery("U_UPDATE_MODELLO_DELEGA");
                q.setParam("idDelegato", modelloDelega.IdUtenteDelegato);
                q.setParam("idRuoloDelegato", modelloDelega.IdRuoloDelegato);
                if (!string.IsNullOrEmpty(modelloDelega.IdRuoloDelegante))
                {
                    q.setParam("idRuoloDelegante", modelloDelega.IdRuoloDelegante);
                }
                else
                {
                    q.setParam("idRuoloDelegante", "NULL");
                }
                q.setParam("dataInizio", getToDate(modelloDelega.DataInizio, DATE_FORMAT));
                q.setParam("dataFine", getToDate(modelloDelega.DataFine, DATE_FORMAT));
                q.setParam("intervallo", "" + modelloDelega.Intervallo);
                q.setParam("nome", "'" + modelloDelega.Nome.Replace("'", "''") + "'");
                q.setParam("idModello", modelloDelega.Id);
                string queryString = q.getSQL();
                logger.Debug("Update modello di delega con id " + modelloDelega.Id + ": ");
                logger.Debug(queryString);
                if (!ExecuteNonQuery(queryString))
                {
                    result = false;
                    RollbackTransaction();
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                result = false;
                logger.Debug(e.Message);
            }
            return(result);
        }
示例#11
0
        public static bool updateModelloDelega(ModelloDelega modelloDelega)
        {
            ModDeleghe modDeleghe = new ModDeleghe();

            return(modDeleghe.updateModelloDelega(modelloDelega));
        }
示例#12
0
        public static bool insertModelloDelega(ModelloDelega modelloDelega)
        {
            ModDeleghe modDeleghe = new ModDeleghe();

            return(modDeleghe.insertModelloDelega(modelloDelega));
        }
示例#13
0
 public bool Match(ModelloDelega modelloDelega)
 {
     return(modelloDelega.Stato == _stato);
 }
示例#14
0
 private bool filter(ModelloDelega modello, StatoModelloDelega stato)
 {
     return(modello.Stato == stato);
 }