Exemplo n.º 1
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,
                ModuleId = r.Module.Id,
                r.Action,
                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));
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 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 i   = 0;
            var res = (from r in results
                       select new
            {
                Id = i++,
                r.TableName,
                r.CodeName,
                r.Value1,
                Value2 = r.Value2 ?? "",
                Value3 = r.Value3 ?? "",
                Order = r.DisplayOrder ?? "",
                Status = r.Status ? "check colorGreen" : "close colorRed",
                Protected = r.IsProtected ? "lock colorRed" : "unlock-alt colorGreen"
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 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 i   = 0;
            var res = (from r in results
                       select new
            {
                Id = i++,
                Module = r.Id,
                Path = r.Path ?? "",
                r.Description,
                EntryDate = r.EntryDate.ToString(true),
                Logging = r.EnableLogging ? "eye" : "eye-slash colorRed",
                Status = r.Status == "A" ? "check colorGreen" : "close colorRed"
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
Exemplo n.º 6
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), Int16.MaxValue, pageIndex - 1, out totalRecords);

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                r.Code,
                EntryDate = r.EntryDate.ToString(true),
                Status = r.Status == "A" ? "check colorGreen" : "close colorRed"
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, Int16.MaxValue, pageIndex, totalRecords));
        }
Exemplo n.º 7
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 = LoadSearch(userId, CreateFilter(search));

            totalRecords = results.Count();

            //Convert results into display model
            var res = (from r in results
                       select new
            {
                r.Id,
                Name = r.Property,
                r.Value
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
Exemplo n.º 8
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,
                Url = "<a class='text-primary' href=" + BlCode.LoadSingle(userId, "_System", "DocumentsRootUrl").Value1 + "documents/" + r.Path + " target='_blank' >" + r.Name + "</a>",
                Type = BlCode.GetCodeByLanguage(user, BlCode.LoadSingle(userId, "DocumentType", r.Type)),
                EntryDate = r.EntryDate.ToString(true),
                User = r.UserId == 0 ? "" : BlUser.LoadSingle(r.UserId).UserName,
            }).ToList();


            //Convert display model into json data
            return(GridVm.FormatResult(res, user.PageSize, pageIndex, totalRecords));
        }
Exemplo n.º 9
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));
        }