コード例 #1
0
        public ActionResult Index(string sort, int?page, string searchContent, Guid?memberID)
        {
            var currentPage = page ?? 1;

            ViewData["SortItem"] = sort;
            sort = sort ?? "Name";
            ViewData["PageSize"] = _pageSize;

            ViewData["searchContent"] = searchContent;

            int memberNO = 0;
            EventSignatureController erc = new EventSignatureController();

            if (!string.IsNullOrEmpty(searchContent) && erc.IsInteger(searchContent))
            {
                memberNO = int.Parse(searchContent);
            }

            List <MemberFeePaymentListViewModel> viewModel = (from r in _entities.MemberFeePayments
                                                              where (r.MemberInfo.Name.Contains(searchContent) || searchContent == null || r.MemberInfo.MemberNo == memberNO) && r.MemberInfo.IsActive
                                                              select new MemberFeePaymentListViewModel
            {
                Name = r.MemberInfo.Name,
                MemberNo = r.MemberInfo.MemberNo.Value,
                IMemberID = r.IMemberID,
                FromDate = r.FromDate,
                ToDate = r.ToDate,
                PayAmount = r.PayAmount,
                PaymentMethod = r.PayMethod.Name,
                ReceievedDate = r.ReceivedDate,
            }).OrderByDescending(a => a.ReceievedDate).ToList();

            if (memberID.HasValue)
            {
                viewModel = viewModel.Where(a => a.IMemberID == memberID.Value).OrderByDescending(a => a.ReceievedDate).ToList();
            }
            ViewData["TotalPages"] = (int)Math.Ceiling((float)viewModel.Count() / _pageSize);

            if ((int)ViewData["TotalPages"] < currentPage)
            {
                currentPage = 1;
            }
            ViewData["CurrentPage"] = currentPage;

            viewModel = (viewModel.AsQueryable().OrderBy(a => a.ReceievedDate).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();

            if (viewModel.Count() == 0)
            {
                ViewData["Message"] = "There is no Member Fee Payment record in database, please use \"Create New\" button to create new one.";
            }

            return(View(viewModel));
        }
コード例 #2
0
        public ActionResult GMPast6MonthsHistory(int eventTypeID, string searchContent)
        {
            ViewData["searchContent"] = searchContent;

            int memberNO = 0;
            EventSignatureController erc = new EventSignatureController();

            if (!string.IsNullOrEmpty(searchContent) && erc.IsInteger(searchContent))
            {
                memberNO = int.Parse(searchContent);
            }

            var querys = (from r in _entities.GroupMeditationAttendances
                          where (r.MemberInfo.Name.Contains(searchContent) ||
                                 searchContent == null || r.MemberInfo.MemberNo == memberNO) &&
                          r.MemberInfo.MemberNo.HasValue && r.MemberInfo.MemberNo.Value < 1000 &&
                          !r.MemberInfo.Name.Contains("tester")
                          orderby r.MemberInfo.MemberNo

                          group r by new
            {
                memberInfo = r.MemberInfo,
            } into result
                          select new GMAttendanceCountViewModel()
            {
                MemberInfo = result.Key.memberInfo,
                TotalCount = result.Count(),
            }).OrderBy(a => a.MemberInfo.MemberNo).ToList();

            InternationalGMApplicationController igmac = new InternationalGMApplicationController();

            List <GMAttendanceCountViewModel> viewModel = new List <GMAttendanceCountViewModel>();

            foreach (GMAttendanceCountViewModel query in querys)
            {
                GMAttendanceCountViewModel gmAttendanceCountViewModel = igmac.GetGMAttendanceMonthlyCounts(6, query.MemberInfo);
                viewModel.Add(gmAttendanceCountViewModel);
            }

            return(View(viewModel));
        }
コード例 #3
0
        public ActionResult Index(string sort, int?page, string searchContent, int?IsActive)
        {
            //List<MemberInfo> memberInfo2s = _entities.MemberInfos.ToList();
            //List<OrdinaryMemberInfo> ordinaryMembers = _localEntities.OrdinaryMemberInfos.ToList();
            //foreach (OrdinaryMemberInfo omi in ordinaryMembers)
            //{
            //    if (omi.MemberFeePayByID == 1)
            //    {
            //        MemberInfo mi = _entities.MemberInfos.SingleOrDefault(a => a.MemberID == omi.IMemberID);
            //        if (!mi.MemberFeeExpiredDate.HasValue)
            //        {
            //            mi.MemberFeeExpiredDate = new DateTime(2020, 12, 31);
            //            _entities.SaveChanges();
            //        }
            //    }
            //}
            //return View();

            var currentPage = page ?? 1;

            ViewData["SortItem"] = sort;
            sort = sort ?? "UserName";
            ViewData["PageSize"] = _pageSize;

            ViewData["searchContent"] = searchContent;

            int memberNO = 0;
            EventSignatureController erc = new EventSignatureController();

            if (!string.IsNullOrEmpty(searchContent) && erc.IsInteger(searchContent))
            {
                memberNO = int.Parse(searchContent);
            }

            if (IsActive == null)
            {
                IsActive = 1;
            }
            ViewData["IsActive"] = IsActive;

            List <PublicMemberInfo> memberInfos = (from r in _entities.MemberInfos //OrdinaryMemberInfos
                                                                                   //join h in latestMemberFeePayments on r.MemberID equals h.IMemberID
                                                   where (r.Name.Contains(searchContent) || searchContent == null || r.MemberNo == memberNO)
                                                                                   //&& r.MemberNo.HasValue && r.MemberNo.Value < 1000
                                                                                   //&& !r.Name.Contains("tester")
                                                   && (r.IsActive && IsActive == 1 || !r.IsActive && IsActive == 2 || IsActive == 3)
                                                   select new PublicMemberInfo()
            {
                ID = r.MemberID,
                Name = r.Name,
                DateOfInitiation = r.DateOfInitiation,
                IDCardNo = r.IDCardNo,
                ContactNo = r.ContactNo,
                Gender = r.Gender.Name,
                InitiateType = r.InitiateType.Name,
                IsActive = r.IsActive,
                MemberNo = r.MemberNo,
                MemberFeeExpiredDate = r.MemberFeeExpiredDate,
            }).ToList();

            updateMemberFeeExipredDate(memberInfos);

            ViewData["TotalPages"] = (int)Math.Ceiling((float)memberInfos.Count() / _pageSize);

            if ((int)ViewData["TotalPages"] < currentPage)
            {
                currentPage = 1;
            }
            ViewData["CurrentPage"] = currentPage;

            var sortedMemberInfos = (memberInfos.AsQueryable().OrderBy(a => a.MemberNo).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();

            TempData["viewModel"] = memberInfos.AsQueryable().Where(a => a.MemberNo.HasValue && a.MemberNo < 999).OrderBy(a => a.MemberNo).ToList();

            if (sort == "Name")
            {
                sortedMemberInfos     = (memberInfos.AsQueryable().OrderBy(a => a.Name).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();
                TempData["viewModel"] = memberInfos.AsQueryable().Where(a => a.MemberNo.HasValue && a.MemberNo < 999).OrderBy(a => a.Name).ToList();
            }
            else if (sort == "IDCardNo")
            {
                sortedMemberInfos     = (memberInfos.AsQueryable().OrderBy(a => a.IDCardNo).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();
                TempData["viewModel"] = memberInfos.AsQueryable().Where(a => a.MemberNo.HasValue && a.MemberNo < 999).OrderBy(a => a.IDCardNo).ToList();
            }
            else if (sort == "ContactNo")
            {
                sortedMemberInfos     = (memberInfos.AsQueryable().OrderBy(a => a.ContactNo).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();
                TempData["viewModel"] = memberInfos.AsQueryable().Where(a => a.MemberNo.HasValue && a.MemberNo < 999).OrderBy(a => a.ContactNo).ToList();
            }
            else if (sort == "MemberFeeExpiredDate")
            {
                sortedMemberInfos     = (memberInfos.AsQueryable().OrderBy(a => a.MemberFeeExpiredDate).ThenBy(a => a.MemberNo).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();
                TempData["viewModel"] = memberInfos.AsQueryable().Where(a => a.MemberNo.HasValue && a.MemberNo < 999).OrderBy(a => a.MemberFeeExpiredDate).ThenBy(a => a.MemberNo).ToList();
            }
            //var sortedMemberInfos = (memberInfos.AsQueryable().OrderBy(sort).Skip((currentPage - 1) * _pageSize).Take(_pageSize)).ToList();

            //TempData["Headers"] = GetStringList();
            ViewData["IsFromLocalHost"] = IsFromLocalHost();

            return(View(sortedMemberInfos));
        }