Exemplo n.º 1
0
        public static List <int> GetObjectsPK(string metodo, string parametriMetodo, object[] parametriPadre)
        {
            List <int> retVal = new List <int>();

            //AR Separo i parametri nei loro componenti elementari
            //metodo = Classe.Medodo
            string[] strMetodoAll = null;
            string   strClasse    = "";
            string   strMetodo    = "";

            if (metodo != "" && metodo != null)
            {
                strMetodoAll = metodo.Split('.');
                strClasse    = strMetodoAll[0];
                strMetodo    = strMetodoAll[1];
            }

            string[] stringParam = null;
            if (parametriMetodo != "" && parametriMetodo != null)
            {
                stringParam = parametriMetodo.Split(',');
            }

            //Solo se devo fare qualcosa, chiamo il metodo.
            if (strClasse != "" && strMetodo != "")
            {
                DataSet dsTable = (DataSet)Utilita.InvokeStringMethod(strClasse, strMetodo, parametriPadre);
                if (isFilledDS(dsTable))
                {
                    //Se trovo dei dati, leggo quelli indicati nei parametriMetodo
                    DataTable dtTable = dsTable.Tables[0];
                    int       idRow   = 0;
                    foreach (DataRow r in dsTable.Tables[0].Rows)
                    {
                        foreach (string s in stringParam)
                        {
                            if (dtTable.Columns.Contains(stringParam[0]) && r[stringParam[0]] != DBNull.Value)
                            {
                                retVal.Add(Convert.ToInt32(r[stringParam[0]]));
                            }
                        }
                        idRow++;
                    }
                }
            }

            return(retVal);
        }
Exemplo n.º 2
0
        public static DataSet GetDataSet(string metodo, string parametriMetodo, object[] parametriPadre)
        {
            DataSet retVal = null;

            //AR Separo i parametri nei loro componenti elementari
            //metodo = Classe.Medodo
            string[] strMetodoAll = null;
            string   strClasse    = "";
            string   strMetodo    = "";

            if (metodo != "" && metodo != null)
            {
                strMetodoAll = metodo.Split('.');
                strClasse    = strMetodoAll[0];
                strMetodo    = strMetodoAll[1];
            }

            string[] stringParam = null;
            if (parametriMetodo != "" && parametriMetodo != null)
            {
                stringParam = parametriMetodo.Split(',');
            }

            //Solo se devo fare qualcosa, chiamo il metodo.
            if (strClasse != "" && strMetodo != "")
            {
                DataSet dsTable = (DataSet)Utilita.InvokeStringMethod(strClasse, strMetodo, parametriPadre);
                if (isFilledDS(dsTable))
                {
                    //Se trovo dei dati, leggo quelli indicati nei parametriMetodo
                    retVal = dsTable;
                }
            }

            return(retVal);
        }