Exemplo n.º 1
0
        internal void PopulateFields(Message message)
        {
            Log.LogMessage(LogLevels.DETAILED, "Populate fields");
            Log.LogMessage(LogLevels.DETAILED, "Source: " + message.ToString());

            CurrentToOldValues();

            int fieldCount = message.NumElements;

            Element e = message.AsElement;

            for (int i = 0; i < fieldCount; i++)
            {
                Element f = e.GetElement(i);

                String fieldName = f.Name.ToString();

                Field fd = field(fieldName);

                if (fd == null)
                {
                    fd = new Field(this);
                }

                fd.SetName(fieldName);

                if (!f.IsNull)
                {
                    fd.SetCurrentValue(f.GetValueAsString());
                }
                else
                {
                    fd.SetCurrentValue("");
                }

                Log.LogMessage(LogLevels.DETAILED, "Setting field: " + fd.Name() + "\tvalue: " + fd.Value());
            }

            fieldChanges = new List <FieldChange>();

            foreach (Field f in fields)
            {
                FieldChange fc = f.GetFieldChanged();

                if (fc != null)
                {
                    fieldChanges.Add(fc);
                    f.sendNotifications(new List <FieldChange> {
                        fc
                    });
                }
            }
        }
Exemplo n.º 2
0
        internal FieldChange GetFieldChanged()
        {
            FieldChange fc = null;

            if (!this.current_value.Equals(this.old_value))
            {
                fc          = new FieldChange();
                fc.field    = this;
                fc.oldValue = this.old_value;
                fc.newValue = this.current_value;
            }
            return(fc);
        }