Ejemplo n.º 1
0
        private static string BuildQueryParams(WadoDataSetModel model, List <string> execluded)
        {
            string query = "?";

            foreach (var propertyInfo in model.GetType().GetProperties())
            {
                if (null != execluded)
                {
                    if (execluded.Exists(x => (x == propertyInfo.Name)))
                    {
                        continue;
                    }
                }

                var value = propertyInfo.GetValue(model) as string;

                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                query += propertyInfo.Name + "=" + value + "&";
            }
            query = query.TrimEnd('&').TrimEnd('?');
            return(query);
        }
Ejemplo n.º 2
0
        internal static WadoDataSetModel FromProperties(Dictionary <string, string> prp)
        {
            var model = new WadoDataSetModel();

            foreach (var propertyInfo in model.GetType().GetProperties())
            {
                if (prp.ContainsKey(propertyInfo.Name))
                {
                    propertyInfo.SetValue(model, FormatProperty(propertyInfo.Name, prp));
                }
            }

            return(model);
        }