Ejemplo n.º 1
0
        private void ReadColumnConfiguration(ref IFilterRequest message, string key, object value)
        {
            Match match = Regex.Match(key, @"columns\[([0-9]+)\](.+)");

            if (match.Success && match.Groups.Count == 3)
            {
                int    index        = Convert.ToInt32(match.Groups[1].Value);
                string propertyName = match.Groups[2].Value;

                IColumn currentColumn;

                if (!message.HasColumn(index))
                {
                    currentColumn = new Column();
                    message.Columns.Add(index, currentColumn);
                }
                else
                {
                    currentColumn = message.GetColumn(index);
                }

                if (propertyName == "[data]")
                {
                    currentColumn.Data = GetValue <string>(value);
                }

                else if (propertyName == "[name]")
                {
                    currentColumn.Name = GetValue <string>(value);
                }

                else if (propertyName == "[searchable]")
                {
                    currentColumn.Searchable = GetValue <bool>(value);
                }

                else if (propertyName == "[orderable]")
                {
                    currentColumn.Sortable = GetValue <bool>(value);
                }

                else if (propertyName == "[search][value]")
                {
                    currentColumn.Search.Value = GetValue <string>(value);
                }

                else if (propertyName == "[search][regex]")
                {
                    currentColumn.Search.IsRegex = GetValue <bool>(value);
                }
            }
        }
Ejemplo n.º 2
0
        private void ReadColumnConfiguration(ref IFilterRequest message, JProperty property)
        {
            int    separatorIndex = property.Name.LastIndexOf("_");
            int    index          = Convert.ToInt32(property.Name.Substring(separatorIndex + 1));
            string propertyName   = property.Name.Substring(0, separatorIndex);

            IColumn currentColumn = null;

            if (!message.HasColumn(index))
            {
                currentColumn = new Column();
                message.Columns.Add(index, currentColumn);
            }
            else
            {
                currentColumn = message.GetColumn(index);
            }

            if (propertyName == "mDataProp")
            {
                currentColumn.Data = property.Value.ToObject <string>();
            }

            else if (propertyName == "bSearchable")
            {
                currentColumn.Searchable = property.Value.ToObject <bool>();
            }

            else if (propertyName == "bSortable")
            {
                currentColumn.Sortable = property.Value.ToObject <bool>();
            }

            else if (propertyName == "sSearch")
            {
                currentColumn.Search.Value = property.Value.ToObject <string>();
            }

            else if (propertyName == "bRegex")
            {
                currentColumn.Search.IsRegex = property.Value.ToObject <bool>();
            }
        }
		private void ReadColumnConfiguration(ref IFilterRequest message, JProperty property)
		{
			Match match = Regex.Match(property.Name, @"columns\[([0-9]+)\](.+)");
			if (match.Success && match.Groups.Count == 3)
			{
				int index = Convert.ToInt32(match.Groups[1].Value);
				string propertyName = match.Groups[2].Value;

				IColumn currentColumn = null;

				if (!message.HasColumn(index))
				{
					currentColumn = new Column();
					message.Columns.Add(index, currentColumn);
				}
				else
					currentColumn = message.GetColumn(index);

				if (propertyName == "[data]")
					currentColumn.Data = property.Value.ToObject<string>();

				else if (propertyName == "[name]")
					currentColumn.Name = property.Value.ToObject<string>();

				else if (propertyName == "[searchable]")
					currentColumn.Searchable = property.Value.ToObject<bool>();

				else if (propertyName == "[orderable]")
					currentColumn.Sortable = property.Value.ToObject<bool>();

				else if (propertyName == "[search][value]")
					currentColumn.Search.Value = property.Value.ToObject<string>();

				else if (propertyName == "[search][regex]")
					currentColumn.Search.IsRegex = property.Value.ToObject<bool>();
			}
		}
		private void ReadColumnConfiguration(ref IFilterRequest message, JProperty property)
		{
			int separatorIndex = property.Name.LastIndexOf("_");
			int index = Convert.ToInt32(property.Name.Substring(separatorIndex + 1));
			string propertyName = property.Name.Substring(0, separatorIndex);

			IColumn currentColumn = null;

			if (!message.HasColumn(index))
			{
				currentColumn = new Column();
				message.Columns.Add(index, currentColumn);
			}
			else
				currentColumn = message.GetColumn(index);

			if (propertyName == "mDataProp")
				currentColumn.Data = property.Value.ToObject<string>();

			else if (propertyName == "bSearchable")
				currentColumn.Searchable = property.Value.ToObject<bool>();

			else if (propertyName == "bSortable")
				currentColumn.Sortable = property.Value.ToObject<bool>();

			else if (propertyName == "sSearch")
				currentColumn.Search.Value = property.Value.ToObject<string>();

			else if (propertyName == "bRegex")
				currentColumn.Search.IsRegex = property.Value.ToObject<bool>();
		}