Exemplo n.º 1
0
 private Int32 ResolveProperty(PageExample example, PageEvaluataion page, ControlEvaluataion control)
 {
     var dynamicTotlal = 0;
     foreach (var property in control.Propertys)
     {
         if (!String.IsNullOrEmpty(property.OrignalScript))
         {
             try
             {
                 var scripts = ScriptUtility.GetMatchedScriptFromProperty(property.OrignalScript);
                 foreach (Match script in scripts)
                 {
                     property.OrignalScript = property.OrignalScript.Replace(
                         script.Value,
                         PropertyValueTransform.TransformToScript(page, script.Value));
                 }
                 ComplieScript(property);
                 dynamicTotlal++;
             }
             catch (Exception ex)
             {
                 PageLogger.RecordErrorLog("ResolvePageProperty", ex);
             }
         }
     }
     return dynamicTotlal;
 }
Exemplo n.º 2
0
 public object Clone()
 {
     var result = new ControlEvaluataion();
     result.ControlId = ControlId;
     foreach (var item in Propertys)
     {
         result.Propertys.Add(item.Clone() as PropertyEvaluataion);
     }
     foreach (var item in Events)
     {
         result.Events.Add(item.Clone() as EventEvaluataion);
     }
     return result;
 }
Exemplo n.º 3
0
 private List<PropertyResponse> EvaluateProperty(ControlEvaluataion control)
 {
     var resultValue = new List<PropertyResponse>();
     foreach (var property in control.Propertys)
     {
         if (property.CompiledScript != null)
         {
             dynamic result = EngineUtility.ExecuteCompiledCode(property.CompiledScript,
                 PageCompiledCodeContext.Instance);
             var value = PageDynamicValueTrans.Instance.Transform(result, property.Type);
             var isRefresh = property.Refresh(value,
                 property.Type == PropertyValueType.xml.ToString() ? false : true);
             if (isRefresh == true)
             {
                 resultValue.Add(PropertyEvaluataionTransform.TransformToPropertyResponse(property));
             }
         }
     }
     return resultValue;
 }
Exemplo n.º 4
0
        private static void RecursionEvaluatePageControl(PageControl control, PageControl expression, PageEvaluataion evaluate)
        {
            var expressionControl = control.Clone() as PageControl;
            expressionControl.Children.Clear();
            var evaluationControl = new ControlEvaluataion();
            evaluationControl.ControlId = control.Id;
            EvaluatePageControlProperty(control, expressionControl, evaluationControl);
            EvaluatePageControlEvent(control, expressionControl, evaluationControl);
            expression.Children.Add(expressionControl);
            if (evaluationControl.Propertys.Count > 0
                || evaluationControl.Events.Count > 0)
            {
                evaluate.PageControls.Add(evaluationControl);
            }

            foreach (var child in control.Children)
            {
                RecursionEvaluatePageControl(child, expressionControl, evaluate);
            }
        }
Exemplo n.º 5
0
 private Int32 ResolveEvent(PageExample example, PageEvaluataion page, ControlEvaluataion control)
 {
     var dynamicTotlal = 0;
     foreach (var events in control.Events)
     {
         if (!String.IsNullOrEmpty(events.OrignalScript))
         {
             try
             {
                 events.OrignalScript = EventValueTransform.TransformToScript(page, example.InstanceId,
                     control.ControlId, events.Name, events.OrignalScript);
                 ComplieScript(events);
                 dynamicTotlal++;
             }
             catch (Exception ex)
             {
                 PageLogger.RecordErrorLog("ResolvePageProperty", ex);
             }
         }
     }
     return dynamicTotlal;
 }
Exemplo n.º 6
0
 private PropertyEvaluataion FindProperty(PageExample example, ControlEvaluataion control, String propertyId)
 {
     var property = control.Propertys.FirstOrDefault(p => p.Name == propertyId);
     if (property == null)
     {
         property = new PropertyEvaluataion();
         property.Name = propertyId;
         property.Type = PropertyValueType.str.ToString();
         property.OrignalScript = String.Empty;
     }
     return property;
 }
Exemplo n.º 7
0
 private ControlEvaluataion FindControl(PageExample example, String controlId)
 {
     var control = example.Evaluataion.PageControls.FirstOrDefault(c => c.ControlId == controlId);
     if (control == null)
     {
         control = new ControlEvaluataion();
         control.ControlId = controlId;
         example.Evaluataion.PageControls.Add(control);
     }
     return control;
 }
Exemplo n.º 8
0
        private static void ClearSpiltProperty(PageControl expressionControl, ControlEvaluataion evaluationControl)
        {
            if (expressionControl.Type == ToolBoxType.Flash.ToString())
            {
                var expressProperty = expressionControl.Properties.FirstOrDefault(p => p.Name == PropertyUtility.DYNAMICNAME);
                if (expressProperty != null)
                {
                    expressionControl.Properties.Remove(expressProperty);
                }

                var evaProperty = evaluationControl.Propertys.FirstOrDefault(p => p.Name == PropertyUtility.DYNAMICNAME);
                if (evaProperty != null)
                {
                    evaluationControl.Propertys.Remove(evaProperty);
                }
            }
        }
Exemplo n.º 9
0
 private static void EvaluatePageControlEvent(PageControl control, PageControl expressionControl,
     ControlEvaluataion evaluationControl)
 {
     foreach (var events in control.Events)
     {
         var pageValue = String.Empty;
         var othersValue = String.Empty;
         if (!String.IsNullOrEmpty(events.Value))
         {
             events.Value = ScriptUtility.TrimScript(events.Value);
             SplitPageControlEventValue(events.Value, out pageValue, out othersValue);
             events.Value = othersValue;
             var evaluateEvent = EventEvaluataionTransform.TransformToEventEvaluataion(events);
             evaluationControl.Events.Add(evaluateEvent);
         }
         var tempEvent = expressionControl.Events.FirstOrDefault(p => p.Name == events.Name);
         if (tempEvent != null)
         {
             if (!String.IsNullOrEmpty(pageValue))
                 tempEvent.Value = pageValue;
             else if (!String.IsNullOrEmpty(othersValue))
                 tempEvent.Value = events.Name;
             else
                 expressionControl.Events.Remove(tempEvent);
         }
     }
 }
Exemplo n.º 10
0
        private static void EvaluatePageControlProperty(PageControl control, PageControl expressionControl,
            ControlEvaluataion evaluationControl)
        {
            foreach (var property in control.Properties)
            {
                if (ScriptUtility.IsEvaluateScript(property.Value))
                {
                    property.Value = ScriptUtility.TrimScript(property.Value);
                    var evaluateProperty = PropertyEvaluataionTransform.TransformToPropertyEvaluataion(property);
                    evaluationControl.Propertys.Add(evaluateProperty);
                    var tempProperty = expressionControl.Properties.FirstOrDefault(p => p.Name == property.Name);
                    if (tempProperty != null)
                    {
                        expressionControl.Properties.Remove(tempProperty);
                    }
                }
            }

            ClearSpiltProperty(expressionControl, evaluationControl);
        }
 public static ControlResponse TransformToPropertyEvaluataion(ControlEvaluataion control)
 {
     var result = new ControlResponse();
     result.ControlId = control.ControlId;
     return result;
 }