Example #1
0
 /// <summary>
 /// Creates an instance of <see cref="SampleRuleBase"/>
 /// </summary>
 /// <param name="name">Name of the sample rule</param>
 /// <param name="description">Description of the sample rule</param>
 /// <param name="type">Type of the sample rule</param>
 /// <param name="embeddedXmlName">Name of the resource file containing the sample rule xml</param>
 public SampleRuleBase(string name, string description, ServerRuleTypeEnum type, string embeddedXmlName)
 {
     _name = name;
     _description = description;
     _type = type;
     _embeddedXmlName = embeddedXmlName;
 }
Example #2
0
 public ServerRule(
      String _ruleName_
     ,ServerEntityKey _serverPartitionKey_
     ,ServerRuleTypeEnum _serverRuleTypeEnum_
     ,ServerRuleApplyTimeEnum _serverRuleApplyTimeEnum_
     ,Boolean _enabled_
     ,Boolean _defaultRule_
     ,Boolean _exemptRule_
     ,XmlDocument _ruleXml_
     ):base("ServerRule")
 {
     RuleName = _ruleName_;
     ServerPartitionKey = _serverPartitionKey_;
     ServerRuleTypeEnum = _serverRuleTypeEnum_;
     ServerRuleApplyTimeEnum = _serverRuleApplyTimeEnum_;
     Enabled = _enabled_;
     DefaultRule = _defaultRule_;
     ExemptRule = _exemptRule_;
     RuleXml = _ruleXml_;
 }
Example #3
0
 public ServerRule(
     String _ruleName_
     , ServerEntityKey _serverPartitionKey_
     , ServerRuleTypeEnum _serverRuleTypeEnum_
     , ServerRuleApplyTimeEnum _serverRuleApplyTimeEnum_
     , Boolean _enabled_
     , Boolean _defaultRule_
     , Boolean _exemptRule_
     , XmlDocument _ruleXml_
     ) : base("ServerRule")
 {
     RuleName                = _ruleName_;
     ServerPartitionKey      = _serverPartitionKey_;
     ServerRuleTypeEnum      = _serverRuleTypeEnum_;
     ServerRuleApplyTimeEnum = _serverRuleApplyTimeEnum_;
     Enabled     = _enabled_;
     DefaultRule = _defaultRule_;
     ExemptRule  = _exemptRule_;
     RuleXml     = _ruleXml_;
 }
        private static string GetJavascriptForSampleRule(ServerRuleTypeEnum typeEnum, object[] extensions)
        {
            string sampleList = string.Empty;

            foreach (ISampleRule extension in extensions)
            {
                if (extension.Type.Equals(typeEnum))
                {
                    sampleList +=
                        String.Format(
                            @"        myEle = document.createElement('option') ;
                    myEle.value = '{0}';
                    myEle.text = '{1}' ;
                    if(navigator.appName == 'Microsoft Internet Explorer') sampleList.add(myEle);
                    else sampleList.add(myEle, null);",
                            extension.Name, extension.Description);
                }
            }
            string enumList = string.Empty;

            foreach (ISampleRule extension in extensions)
            {
                if (extension.Type.Equals(typeEnum))
                {
                    foreach (ServerRuleApplyTimeEnum applyTimeEnum in extension.ApplyTimeList)
                    {
                        enumList +=
                            String.Format(
                                @"myEle = document.createElement('option') ;
                    myEle.value = '{0}';
                    myEle.text = '{1}';
                    if(navigator.appName == 'Microsoft Internet Explorer') applyTimeList.add(myEle);
                    else applyTimeList.add(myEle, null);",
                                applyTimeEnum.Lookup, ServerEnumDescription.GetLocalizedDescription(applyTimeEnum));
                    }
                    break;
                }
            }

            return
                String.Format(
                    @"if (val == '{0}')
                {{
					{1}
                    myEle = document.createElement('option') ;
                    myEle.value = '';
                    myEle.text = '' ;
                    if(navigator.appName == 'Microsoft Internet Explorer') sampleList.add(myEle);
                    else sampleList.add(myEle, null);
                    {2}
                }}",
                    typeEnum.Lookup, enumList, sampleList);
        }
        private static string GetJavascriptForSampleRule(ServerRuleTypeEnum typeEnum, object[] extensions)
        {
            string sampleList = string.Empty;

            foreach (ISampleRule extension in extensions)
            {
                sampleList +=
                    String.Format(
                        @"        myEle = document.createElement('option') ;
                    myEle.value = '{0}';
                    myEle.text = '{1}' ;
                    if(navigator.appName == 'Microsoft Internet Explorer') sampleList.add(myEle);
                    else sampleList.add(myEle, null);",
                        extension.Name, extension.Description);
            }
         
            return
                String.Format(
                    @"if (val == '{0}')
                {{
                    myEle = document.createElement('option') ;
                    myEle.value = '';
                    myEle.text = '' ;
                    if(navigator.appName == 'Microsoft Internet Explorer') sampleList.add(myEle);
                    else sampleList.add(myEle, null);
                    {1}
                }}",
                    typeEnum.Lookup, sampleList);
        }