示例#1
0
        public GridResults LoadPaging(long userId, string search, int pageIndex, out long totalRecords, string sortColumnName = "", string sortOrderBy = "")
        {
            //Get current user
            var user = LoadSingle(userId);

            //Query paged data
            var results = LoadPaging(userId, CreateFilter(search), user.PageSize, pageIndex - 1, out totalRecords);

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                r.UserName,
                Name = BlEntity.FormatFullName(r.Entity),
                Language = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "Language", r.LanguageId.ToUiString())),
                r.PageSize,
                roles = string.Join(",", r.Roles.Select(ro => ro.Code)),
                Branch = BlBranch.GetBranchName(user.Id, r.BranchId),
                IsBlocked = r.IsBlocked ? "close colorRed" : "check colorGreen"
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
示例#2
0
        public GridResults LoadPaging(long userId, string search, int pageIndex, out long totalRecords, string sortColumnName = "", string sortOrderBy = "")
        {
            //Get current user
            var user = BlUser.LoadSingle(userId);

            //Query paged data
            var results = LoadPaging(userId, CreateFilter(search), user.PageSize, pageIndex - 1, out totalRecords);

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                Gender = r.Entity.Gender == null ? "" : BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "Gender", r.Entity.Gender)),
                Name = BlEntity.FormatFullName(r.Entity),
                Number = r.Entity.IdType == "M" ? r.Entity.IdNum : "",
                r.Entity.FullEnLongName,
                Level = r.Level == null ? "" : BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "EmployeeLevel", r.Level)),
                Status = r.Status == "A" ? "check colorGreen" : "close colorRed"
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
示例#3
0
        public GridResults LoadPaging(long userId, string search, int pageIndex, out long totalRecords, string sortColumnName = "", string sortOrderBy = "")
        {
            //Get current user
            var user = BlUser.LoadSingle(userId);

            //Query paged data
            var results = LoadPaging(userId, CreateFilter(search), user.PageSize, pageIndex - 1, out totalRecords);

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                Type = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "ErrorType", r.Type.ToString())),
                Severity = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "ErrorSeverity", r.Severity.ToString())),
                Source = r.Source ?? "",
                Text = r.Text ?? "",
                User = r.UserId == 0 ? "" : BlUser.LoadSingle(r.UserId).UserName,
                branch = BlBranch.GetBranchName(user.Id, r.BranchId),
                LogDate = r.EntryDate.ToString(true)
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
示例#4
0
        public ErrorVm Init(long userId, long id)
        {
            //Get current user
            var user = BlUser.LoadSingle(userId);

            var error = LoadSingle(userId, id);
            var toRet = new ErrorVm
            {
                Type     = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "ErrorType", error.Type.ToUiString())),
                Severity = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "ErrorSeverity", error.Severity.ToUiString())),
                Source   = error.Source,
                Text     = error.Text,
                UserName = BlUser.LoadSingle(error.UserId).UserName,
                Branch   = BlBranch.GetBranchName(user.Id, error.BranchId),
                Date     = error.EntryDate.ToString(true)
            };

            return(toRet);
        }
示例#5
0
        public GridResults LoadPaging(long userId, string search, int pageIndex, out long totalRecords, string sortColumnName = "", string sortOrderBy = "")
        {
            //Get current user
            var user = BlUser.LoadSingle(userId);

            //Query paged data
            var results = LoadPaging(userId, CreateFilter(search), user.PageSize, pageIndex - 1, out totalRecords);

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                Language = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "Language", r.LanguageId.ToUiString())),
                Parent = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "DescriptionParent", r.Parent)),
                r.Code,
                r.Text
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }