Beispiel #1
0
        public JsonResult GetRoles()
        {
            var ret         = Result.Default;
            var queryParams = new QueryParams(WebHelper.Params);

            if (string.IsNullOrEmpty(queryParams.OrderBy))
            {
                queryParams.OrderBy = $"{RoleCols.Id}";
                queryParams.IsAsc   = true;
            }
            queryParams.Table = $"{EntityType.Role}";
            var isInner = (-1).TryParse(WebHelper.Params["IsInner"]);

            if (isInner == 0 || isInner == 1)
            {
                queryParams.WhereClause = $"[{RoleCols.IsInner}] = {isInner}";
            }

            var list = DbProxy.GetPageRecords <RoleInfo>(queryParams);

            ret.Value = this.RenderView("Role.Partial", list);
            ret.Tag   = queryParams.RecordCount;

            return(Json(ret));
        }
Beispiel #2
0
        public JsonResult GetOperationLogs()
        {
            var ret         = Result.Default;
            var queryParams = new QueryParams(WebHelper.Params);

            if (string.IsNullOrEmpty(queryParams.OrderBy))
            {
                queryParams.OrderBy = $"{OperationLogCols.Id}";
                queryParams.IsAsc   = false;
            }

            var isVague = 0.TryParse(WebHelper.Params["IsVague"]) == 1; //是否为模糊查询

            queryParams.Table       = $"{EntityType.OperationLog}";
            queryParams.WhereClause = "CreateTime".ToSaftBetweenDateSql(WebHelper.Params["dtStart"], WebHelper.Params["dtEnd"], true);

            var operationType = (OperationType)(-1).TryParse(WebHelper.Params["OperationType"]);

            if ((int)operationType > 0)
            {
                queryParams.WhereClause += $" and [{OperationLogCols.Type}] = {(int)operationType}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["BusinessName"]))
            {
                queryParams.WhereClause += $" and BusinessName {WebHelper.Params["BusinessName"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["LoginName"]))
            {
                queryParams.WhereClause += $" and LoginName {WebHelper.Params["LoginName"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["IP"]))
            {
                queryParams.WhereClause += $" and IP {WebHelper.Params["IP"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["Description"]))
            {
                queryParams.WhereClause += $" and Description {WebHelper.Params["Description"].ToSaftVagueSql(isVague)}";
            }

            var list = DbProxy.GetPageRecords <OperationLogInfo>(queryParams);

            ret.Value = this.RenderView("OperationLog.Partial", list);
            ret.Tag   = queryParams.RecordCount;

            return(Json(ret));
        }
Beispiel #3
0
        public JsonResult GetExceptionLogs()
        {
            var ret         = Result.Default;
            var queryParams = new QueryParams(WebHelper.Params);

            if (string.IsNullOrEmpty(queryParams.OrderBy))
            {
                queryParams.OrderBy = $"{ExceptionLogCols.Id}";
                queryParams.IsAsc   = false;
            }
            var isVague = 0.TryParse(WebHelper.Params["IsVague"]) == 1; //是否为模糊查询

            queryParams.Table       = $"{EntityType.ExceptionLog}";
            queryParams.SelectCols  = $"[{ExceptionLogCols.Id}], [{ExceptionLogCols.LoginName}], [{ExceptionLogCols.Url}], [{ExceptionLogCols.Ip}], [{ExceptionLogCols.Message}], [{ExceptionLogCols.CreateTime}]";
            queryParams.WhereClause = "CreateTime".ToSaftBetweenDateSql(WebHelper.Params["dtStart"], WebHelper.Params["dtEnd"], true);

            if (!string.IsNullOrEmpty(WebHelper.Params["LoginName"]))
            {
                queryParams.WhereClause += $" and LoginName {WebHelper.Params["LoginName"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["Url"]))
            {
                queryParams.WhereClause += $" and Url {WebHelper.Params["Url"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["IP"]))
            {
                queryParams.WhereClause += $" and IP {WebHelper.Params["IP"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["Message"]))
            {
                queryParams.WhereClause += $" and Message {WebHelper.Params["Message"].ToSaftVagueSql(isVague)}";
            }

            var list = DbProxy.GetPageRecords <ExceptionLogInfo>(queryParams);

            ret.Value = this.RenderView("ExceptionLog.Partial", list);
            ret.Tag   = queryParams.RecordCount;

            return(Json(ret));
        }
Beispiel #4
0
        public JsonResult GetSubAccounts()
        {
            var ret         = Result.Default;
            var queryParams = new QueryParams(WebHelper.Params);

            if (string.IsNullOrEmpty(queryParams.OrderBy))
            {
                queryParams.OrderBy = $"{UserCols.Id}";
                queryParams.IsAsc   = false;
            }
            var isVague = 0.TryParse(WebHelper.Params["IsVague"]) == 1; //是否为模糊查询

            queryParams.Table        = $"{EntityType.User}";
            queryParams.WhereClause  = $"{UserCols.ParentId} = '{Business.User.Current.User.Id}'";
            queryParams.WhereClause += " and " + "CreateTime".ToSaftBetweenDateSql(WebHelper.Params["dtStart"], WebHelper.Params["dtEnd"], false);
            if (!string.IsNullOrEmpty(WebHelper.Params["LoginName"]))
            {
                queryParams.WhereClause += $" and {UserCols.LoginName} {WebHelper.Params["LoginName"].ToSaftVagueSql(isVague)}";
            }

            switch (Business.User.Current.User.Type)
            {
            case UserType.后台管理:
                queryParams.WhereClause += $" and [{UserCols.Type}] = {(int)UserType.管理子帐号}";
                break;

            default:
                ret.Tag = 0;
                return(Json(ret));
            }

            var list = DbProxy.GetPageRecords <UserInfo>(queryParams);

            ret.Value = this.RenderView("SubAccount.Partial", list);
            ret.Tag   = queryParams.RecordCount;

            return(Json(ret));
        }
Beispiel #5
0
        public JsonResult GetUsers()
        {
            var ret         = Result.Default;
            var queryParams = new QueryParams(WebHelper.Params);

            if (string.IsNullOrEmpty(queryParams.OrderBy))
            {
                queryParams.OrderBy = $"{UserCols.Id}";
                queryParams.IsAsc   = false;
            }
            var isVague = 0.TryParse(WebHelper.Params["IsVague"]) == 1; //是否为模糊查询

            queryParams.Table = $"{EntityType.User}";
            var dateType = "CreateTime";

            switch (WebHelper.Params["DateType"])
            {
            case "CreateTime":
                dateType = "CreateTime";
                break;

            case "AvailableTime":
                dateType = "AvailableTime";
                break;

            case "XiMaJieSuanTime":
                dateType = "XiMaJieSuanTime";
                break;
            }
            queryParams.WhereClause = dateType.ToSaftBetweenDateSql(WebHelper.Params["dtStart"], WebHelper.Params["dtEnd"], true);
            if (Business.User.Current.User.Type == UserType.管理子帐号)
            {
                queryParams.WhereClause += $" and {UserCols.Id} != {Business.User.Current.User.Id}";
            }

            var userType = (-1).TryParse(WebHelper.Params["UserType"]);

            if (userType > 0)
            {
                queryParams.WhereClause += $" and [{UserCols.Type}] = {userType}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["LoginName"]))
            {
                queryParams.WhereClause += $" and {UserCols.LoginName} {WebHelper.Params["LoginName"].ToSaftVagueSql(isVague)}";
            }

            if (!string.IsNullOrEmpty(WebHelper.Params["PartnerId"]))
            {
                queryParams.WhereClause += $" and Id in(select UserId from UserCashPartner where PartnerId = {WebHelper.Params["PartnerId"].ToSafeSql()})";
            }

            var isPartner = 0.TryParse(WebHelper.Params["IsPartner"]);

            if (isPartner == 1)
            {
                queryParams.WhereClause += $" and Id in(select UserId from UserCashPartner)";
            }
            else if (isPartner == 2)
            {
                queryParams.WhereClause += $" and Id not in(select UserId from UserCashPartner)";
            }

            var list = DbProxy.GetPageRecords <UserInfo>(queryParams);

            ret.Value = this.RenderView("User.Partial", list);
            ret.Tag   = queryParams.RecordCount;

            return(Json(ret));
        }