Exemplo n.º 1
0
        private static Object GetPropValue(IASQueryResult qrData, int _nRowIndex, int valType)
        {
            Object value;

            if (qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE) == null) {
                value = null;
            }
            else {
                switch (valType) {
                    case PT_PROPERTY_TYPES.PT_PROPTYPE_DOUBLE:
                        value = qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE);

                        break;

                    case PT_PROPERTY_TYPES.PT_PROPTYPE_DATE:
                        value = qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE);

                        break;

                    case PT_PROPERTY_TYPES.PT_PROPTYPE_LONG:
                        value = qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE);

                        break;

                    case PT_PROPERTY_TYPES.PT_PROPTYPE_REF:
                        value = qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE);

                        break;

                    default:
                        value = qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUE);

                        break;
                }
            }

            return value;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get a bunch of values from a query as an arraylist (utility function).
        /// </summary>
        /// <param name="qrData"></param>
        /// <param name="_nRowIndex"></param>
        /// <returns></returns>
        private static XPArrayList GetAllValues(IASQueryResult qrData, int _nRowIndex)
        {
            XPArrayList valList = new XPArrayList();

            int currPropID = XPConvert.ToInteger(qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_OBJECTID));
            int nextPropID;
            int valType;
            Object propVal;

            // first add the current property
            valType = XPConvert.ToInteger(qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUETYPE));
            propVal     = GetPropValue(qrData, _nRowIndex, valType);
            valList.Add(propVal);

            // now check for multiple values
            while (_nRowIndex < (qrData.GetCount() - 1)) {
                nextPropID = XPConvert.ToInteger(qrData.GetFields(_nRowIndex + 1, PT_PROPIDS.PT_PROPID_OBJECTID));

                if (nextPropID == currPropID) {
                    _nRowIndex++;
                    valType     = XPConvert.ToInteger(qrData.GetFields(_nRowIndex, PT_PROPIDS.PT_PROPID_PROP_VALUETYPE));
                    propVal     = GetPropValue(qrData, _nRowIndex, valType);

                    if (propVal != null) {
                        valList.Add(propVal);
                    }
                }
                else {
                    return valList;
                }
            }

            return valList;
        }