Exemplo n.º 1
0
        public override void Render(TextWriter writer)
        {
            object value = GetVariableValue();

            if (MyDataContext.HasVariable(VariableKey))
            {
                MyDataContext.RemoveLocalValue(VariableKey);
            }
            if (string.IsNullOrEmpty(ScopeVariableKey))
            {
                this.MyDataContext.RegisterDataItem(VariableKey, value);
            }
            else
            {
                Dictionary <string, object> scopeDictionary = null;
                if (!MyDataContext.MasterData.ContainsKey(ScopeVariableKey))
                {
                    scopeDictionary = new Dictionary <string, object>();
                    MyDataContext.RegisterLocalValue(ScopeVariableKey, scopeDictionary);
                }
                else
                {
                    scopeDictionary = MyDataContext.GetVariableObject(ScopeVariableKey) as Dictionary <string, object>;
                }
                if (scopeDictionary != null)
                {
                    scopeDictionary.Add(VariableKey, value);
                }
                else
                {
                    //TODO: REGISTER ERROR
                }
            }
        }