code/Athena0.0.1/Web/Code/JqGrid/JqGridHandler.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections.ObjectModel;
using System.Data;
using System.Data.SqlClient;
using System.Web.Script.Serialization;
using Athena.model;
using System.Text;

namespace Web.Controllers.JqGrid
{
    public class JqGridHandler
    {
        public static string getWhere(string filters)
        {
            var f = Athena.common.Util.Json.ToObject<jqgridFilter>(filters);
            string str = "(";
            if (f.groups != null && f.groups.Count() != 0)
                str = str + getGroup(f.groups);
            str = str + getString(f.groupOp, f.rules);
            str = str.Substring(0, str.Length - f.groupOp.Length - 1);
            str = str + ")";
            return str;
        }

        public static string getGroup(List<jqgridFilter> groups)
        {
            string str = "";
            foreach (jqgridFilter group in groups)
            {
                //if (group.groups.Count() != 0)
                str = "(";
                if (group.groups.Count() != 0)
                    str = str + getGroup(group.groups);
                str = str + getString(group.groupOp, group.rules);
                str = str.Substring(0, str.Length - group.groupOp.Length - 1);
                str = str + ")";
                str = str + group.groupOp;
            }
            return str;
        }

        public static string getString(string groupon, List<jqgridRule> rules)
        {
            string str = "";
            foreach (jqgridRule rule in rules)
            {
                Type type = typeof(Athena.model.role);
                var fieldname = type.GetProperty(rule.field);
                var propertytype = fieldname.PropertyType.Name;

                str = str + rule.field;
                switch (rule.op)
                {
                    case "eq":
                        str = str + " " + "=" + " ";
                        if (propertytype == "String")
                            str = str + "'" + rule.data + "'";
后面还有 103 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。