Esempio n. 1
0
		private static string makeParameterExpression ( Parameter[] parameters, bool isWebService, string quote )
		{

			if ( null == quote )
				quote = string.Empty;

			if ( null == parameters || parameters.Length == 0 )
				if ( isWebService )
					return quote + "{ }" + quote;
				else
					return "{ }";


			string parameterExpression = string.Empty;

			foreach ( Parameter parameter in parameters )
				if ( null != parameter && parameter.Value != string.Empty )
					switch ( parameter.Type )
					{
						case ParameterType.Selector:

							if ( isWebService )
							{

								if ( parameterExpression != string.Empty )
									parameterExpression += string.Format ( " + {0} ,{0}", quote );

								parameterExpression += string.Format ( " + {0}{1}: {0} + jQuery.panzer.encodeValue({2}, {3}, {0}{4}{0}, {5})", quote, parameter.Name, JQuery.Create ( string.Format ( "jQuery.panzer.createJQuery({0})", UISetting.CreateJQuerySelector ( parameter.Value ) ) ).Val ( ).Code, parameter.Default, parameter.DataType.ToString ( ).ToLower ( ), parameter.Provider );
							}
							else
								parameterExpression += string.Format ( " {1}: jQuery.panzer.convert({2}, {3}, {0}{4}{0}, {5}),", quote, parameter.Name, JQuery.Create ( string.Format ( "jQuery.panzer.createJQuery({0})", UISetting.CreateJQuerySelector ( parameter.Value ) ) ).Val ( ).Code, parameter.Default, parameter.DataType.ToString ( ).ToLower ( ), parameter.Provider );

							break;

						case ParameterType.Expression:

							if ( isWebService )
							{

								if ( parameterExpression != string.Empty )
									parameterExpression += string.Format ( " + {0} ,{0}", quote );

								parameterExpression += string.Format ( " + {0}{1}: {0} + jQuery.panzer.encodeValue({2}, {3}, {0}{4}{0}, {5})", quote, parameter.Name, parameter.Value, parameter.Default, parameter.DataType.ToString ( ).ToLower ( ), parameter.Provider );
							}
							else
								parameterExpression += string.Format ( " {1}: jQuery.panzer.convert({2}, {3}, {0}{4}{0}, {5}),", quote, parameter.Name, parameter.Value, parameter.Default, parameter.DataType.ToString ( ).ToLower ( ), parameter.Provider );

							break;
					}

			if ( isWebService )
				parameterExpression = quote + "{" + quote + parameterExpression + " + " + quote + "}" + quote;
			else
				parameterExpression = "{" + parameterExpression.TrimEnd ( ',' ) + "}";

			return parameterExpression;
		}
Esempio n. 2
0
		/// <summary>
		/// 为 AjaxSetting 增加参数, 将排除已经存在的参数.
		/// </summary>
		/// <param name="ajax">增加参数的 AjaxSetting.</param>
		/// <param name="parameters">增加的参数.</param>
		public static void AppendParameter (AjaxSetting ajax, Parameter[] parameters )
		{

			if ( null == ajax || null == parameters )
				return;

			List<string> names = new List<string> ( );

			foreach ( Parameter parameter in ajax.ParameterList )
				names.Add ( parameter.Name );

			foreach ( Parameter parameter in parameters )
				if ( null != parameter && !names.Contains ( parameter.Name ) )
					ajax.ParameterList.Add ( parameter );

		}
Esempio n. 3
0
		/// <summary>
		/// 创建 jQuery UI Ajax 设置.
		/// </summary>
		/// <param name="eventType">相关的触发事件.</param>
		/// <param name="url">请求的地址, 比如: "''".</param>
		/// <param name="methodName">调用的 WebService 的方法名称.</param>
		/// <param name="dataType">获取的数据类型.</param>
		/// <param name="type">请求的类型.</param>
		/// <param name="contentType">请求的内容类型.</param>
		/// <param name="form">用作传递参数的表单.</param>
		/// <param name="data">传递的数据, 如果不为空将覆盖 ParameterList.</param>
		/// <param name="parameters">用作传递的参数, 如果指定了 form 参数, 则忽略 parameters.</param>
		/// <param name="events">Ajax 相关事件.</param>
		/// <param name="isSingleQuote">是否为字符串使用单引号.</param>
		/// <param name="ajaxManagerID">客户端脚本存放的 AjaxManager 控件的 ID.</param>
		/// <param name="clientFunction">调用的客户端函数, 而在 AjaxManager 中则表示定义的函数名称.</param>
		/// <param name="clientParameter">AjaxManager 中定义的函数参数.</param>
		public AjaxSetting ( EventType eventType, string url, string methodName, DataType dataType, RequestType type, string contentType, string form, string data, Parameter[] parameters, Event[] events, bool isSingleQuote, string ajaxManagerID, string clientFunction, string clientParameter )
		{
			this.Parameters = parameters;
			this.settingHelper.Events = events;

			this.eventType = eventType;
			this.Url = url;
			this.MethodName = methodName;

			this.dataType = dataType;
			this.type = type;

			this.ContentType = contentType;
			this.Form = form;
			this.Data = data;

			this.isSingleQuote = isSingleQuote;

			this.AjaxManagerID = ajaxManagerID;
			this.ClientFunction = clientFunction;
			this.ClientParameter = clientParameter;
		}