getPosition() public méthode

public getPosition ( ) : int
Résultat int
Exemple #1
0
        public static void setParametersAux(cConnect connect, cReportConnect rptConnect)
        {
            rptConnect.getColumns().clear();
            rptConnect.getParameters().clear();

            for (int i = 0; i < connect.getColumnsInfo().count(); i++)
            {
                CSConnect.cColumnInfo   colInfo    = connect.getColumnsInfo().item(i);
                CSReportDll.cColumnInfo rptColInfo = new CSReportDll.cColumnInfo();

                rptColInfo.setName(colInfo.getName());
                rptColInfo.setPosition(colInfo.getPosition());
                rptColInfo.setColumnType(colInfo.getColumnType());
                rptConnect.getColumns().add(rptColInfo, "");
            }

            for (int i = 0; i < connect.getParameters().count(); i++)
            {
                CSConnect.cParameter   parameter    = connect.getParameters().item(i);
                CSReportDll.cParameter rptParameter = new CSReportDll.cParameter();

                rptParameter.setName(parameter.getName());
                rptParameter.setPosition(parameter.getPosition());
                rptParameter.setColumnType(parameter.getColumnType());
                rptParameter.setValue(parameter.getValue());
                rptConnect.getParameters().add(rptParameter, "");
            }
        }
Exemple #2
0
 public cParameter getByPosition(int position)
 {
     for (var i = 0; i < count(); i++)
     {
         cParameter p = item(i);
         if (p.getPosition() == position)
         {
             return(p);
         }
     }
     throw new Exception("This parameters collection doesn't contain a parameter with a position = " + position.ToString());
 }
Exemple #3
0
        public bool fillParameters(string dataSource)
        {
            cDataBase db = new cDataBase(csDatabaseEngine.SQL_SERVER);

            if (db.initDb(m_strConnect))
            {
                string[] restrictions = new string[4];
                restrictions[2] = dataSource;
                DataTable dt = db.openSchema("ProcedureParameters", restrictions);

                if (m_parameters == null)
                {
                    m_parameters = new cParameters();
                }

                cParameters parameters = new cParameters();

                foreach (DataRow row in dt.Rows)
                {
                    if (row["parameter_mode"].ToString() != "OUT")
                    {
                        cParameter p     = null;
                        bool       found = false;
                        for (var i = 0; i < m_parameters.count(); i++)
                        {
                            p = m_parameters.item(i);
                            if (p.getName() == row["parameter_name"].ToString())
                            {
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            p = null;
                        }
                        p = parameters.add(p, "");
                        p.setName(row["parameter_name"].ToString());
                        p.setPosition((int)row["ordinal_position"]);
                        p.setColumnType(cDatabaseGlobals.getDataTypeFromString(row["data_type"].ToString()));
                    }
                }
                //
                // openSchema can be sorted by any column (usually by name)
                // we need this collection to be sorted by position
                //
                m_parameters = new cParameters();

                for (var j = 1; j < parameters.count() + 1; j++)
                {
                    cParameter p     = null;
                    bool       found = false;
                    for (var i = 0; i < parameters.count(); i++)
                    {
                        p = parameters.item(i);
                        if (p.getPosition() == j)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        throw new Exception("Parameter not found for position: " + j);
                    }
                    else
                    {
                        m_parameters.add(p, p.getKey());
                    }
                }

                return(true);
            }

            return(false);
        }