コード例 #1
0
        public List <Sheet> GetSheets(SheetQueryParameter2 parameter)
        {
            var query = DB.SheetViews.Where(e => e.Deleted == false).AsQueryable();

            if (parameter.GroupId.HasValue)
            {
                if (!string.IsNullOrEmpty(parameter.Name))
                {
                    query = query.Where(e => e.Name.ToUpper() == parameter.Name.ToUpper());
                }
                else
                {
                    query = query.Where(e => e.GroupID == parameter.GroupId.Value);
                }
            }
            if (parameter.StartTime.HasValue)
            {
                query = query.Where(e => e.CheckTime >= parameter.StartTime.Value);
            }
            if (parameter.EndTime.HasValue)
            {
                query = query.Where(e => e.CheckTime <= parameter.EndTime.Value);
            }
            if (parameter.Type.HasValue)
            {
                query = query.Where(e => e.Type == parameter.Type.Value);
                switch (parameter.Type.Value)
                {
                case SheetType.Daily:
                case SheetType.Transfer:
                    if (!string.IsNullOrEmpty(parameter.Category))
                    {
                        query = query.Where(e => e.SubName.ToLower() == parameter.Category.ToLower());
                    }
                    break;

                default:
                    break;
                }
            }
            if (!string.IsNullOrEmpty(parameter.Memo))
            {
                query = query.Where(e => e.Mark.Contains(parameter.Memo) || e.Details.Contains(parameter.Memo));
            }

            var result = query.ToList().Select(e => e.ID).Distinct().ToList();
            var list   = GetSheets(result);

            return(list);
        }
コード例 #2
0
ファイル: BankController.cs プロジェクト: Lincoln007/Kaopu
        public ActionResult AdvanceCollect(DateTime?startTime, DateTime?endTime, string cate, string name, SheetType?type = null)
        {
            var parameter = new SheetQueryParameter2
            {
                StartTime = startTime,
                EndTime   = endTime,
                Category  = cate,
                Name      = name,
                Type      = type
            };
            var sheets = Core.SheetManager.GetSheets(parameter);

            ViewBag.Sheets     = sheets;
            ViewBag.ReportType = Core.Report_TypeManager.Get();
            ViewBag.Parameter  = parameter;
            var users = Core.UserManager.GetAllUsers();

            ViewBag.Users = users.Select(e => e.RealName).ToList();
            return(View());
        }
コード例 #3
0
ファイル: BankController.cs プロジェクト: Lincoln007/Kaopu
        public ActionResult Search(
            DateTime?startTime, DateTime?endTime,
            int?groupId, string name, string memo,
            SheetType?type, string cate)
        {
            var parameter = new SheetQueryParameter2
            {
                StartTime = startTime,
                EndTime   = endTime,
                Category  = cate,
                Name      = name,
                GroupId   = groupId,
                Type      = type,
                Memo      = memo
            };
            var sheets = Core.SheetManager.GetSheets(parameter);

            ViewBag.Sheets = sheets;
            return(View());
        }