Exemplo n.º 1
0
        public static ModelValues Values(this IDbCommand cmd)
        {
            var result = new ModelValues();

            foreach (IDbDataParameter p in cmd.Parameters)
            {
                result.Add(p.ParameterName, p.Value);
            }

            return(result);
        }
Exemplo n.º 2
0
        public static ModelValues ModelValues(this IDictionary <string, object> dictionary)
        {
            var result = new ModelValues();

            foreach (var item in dictionary)
            {
                result.Add(item);
            }

            return(result);
        }
Exemplo n.º 3
0
        public static ModelValues Values(this IDataRecord row)
        {
            var result = new ModelValues();

            for (int i = 0; i < row.FieldCount; i++)
            {
                result.Add(row.GetName(i), row[i]);
            }

            return(result);
        }
Exemplo n.º 4
0
        public static ModelValues Values(this DataRow row)
        {
            var result = new ModelValues();

            var dt = row.Table;

            foreach (DataColumn col in dt.Columns)
            {
                result.Add(col.ColumnName, row[col.ColumnName]);
            }

            return(result);
        }
Exemplo n.º 5
0
        public static ModelValues Values(this HttpRequestBase request, RequestValues source = RequestValues.All)
        {
            var result = new ModelValues();

            if (source == RequestValues.All || source == RequestValues.Querystring)
            {
                foreach (string qs in request.QueryString)
                {
                    result.Add(qs, request.QueryString[qs]);
                }
            }

            if (source == RequestValues.All || source == RequestValues.Form)
            {
                foreach (string qs in request.Form)
                {
                    result.Add(qs, request.Form[qs]);
                }
            }

            return(result);
        }