private void ProcessAttributes(AFAttributeTemplates attributes, string prefix)
        {
            foreach (AFAttributeTemplate attr in attributes)
            {
                if (attr == dataReference.Attribute)
                {
                    continue;
                }

                string attrName = prefix + "|" + attr.Name;

                if (SRHelper.IsIntVal(attr.Type))
                {
                    txtShiftMode.Items.Add(attrName);
                }

                ProcessAttributes(attr.AttributeTemplates, attrName);
            }
        }
        // 2 shifts (2), 3 shifts (3), Unknown (0), Day (-1), Month (-2), Year (-3)
        public override AFValue GetValue(object context, object timeContext, AFAttributeList inputAttributes, AFValues inputValues)
        {
            AFTime time;

            if (timeContext is AFTime)
            {
                time = (AFTime)timeContext;
            }
            else if (timeContext is AFTimeRange)
            {
                var timeRange = (AFTimeRange)timeContext;
                time = (Attribute.Element is AFEventFrame) ? timeRange.StartTime : timeRange.EndTime;
            }
            else if (timeContext is DateTime)
            {
                time = new AFTime((DateTime)timeContext);
            }
            else
            {
                time = AFTime.NowInWholeSeconds;
            }

            int shiftMode = SRHelper.TryGetShiftMode(fShiftMode);

            if (shiftMode == 0)
            {
                try {
                    var attr = AFAttribute.FindAttribute(fShiftMode, Attribute);
                    if (attr == null)
                    {
                        throw new ArgumentException(string.Format(Resources.ERR_AttributeHasNotBeenFound, ShiftMode));
                    }
                    else
                    {
                        object val = attr.GetValue().Value;
                        if (SRHelper.IsIntVal(val))
                        {
                            shiftMode = (int)SRHelper.ConvertToType(val, TypeCode.Int32);
                        }
                        else
                        {
                            shiftMode = 0;
                        }
                    }
                } catch {
                    shiftMode = 0;
                }
            }

            if (shiftMode == 0)
            {
                throw new ArgumentException(Resources.ERR_SourceAttributeMustBeAnIntegerType);
            }

            DateTime localTime = time.LocalTime;

            string[] wsParams;
            if (shiftMode < 0)
            {
                wsParams = SRHelper.GetWorkMacroParams(localTime, shiftMode, fStartOffset);
            }
            else
            {
                wsParams = SRHelper.GetWorkShiftParams(localTime, shiftMode, fStartOffset);
            }
            wsParams[3] = SRHelper.GetPITimeStampStr(localTime);

            return(new AFValue(base.Attribute, wsParams, time, Attribute.DefaultUOM));
        }