コード例 #1
0
        private void bindBurialPlaceList()
        {
            try
            {
                List <BurialPlace> listBurialPlace = new BurialPlaceService().getAll();

                List <Guid> listBurialPlaceID = listBurialPlace
                                                .Select(x => x.BurialPlaceID)
                                                .ToList();

                List <DeadPerson> listDeadPerson = new DeadPersonService().getBy(x => x.BurialPlaceID != null && listBurialPlaceID.Contains(x.BurialPlaceID));

                List <BurialPlaceViewModel> listBurialPlaceViewModel = listBurialPlace
                                                                       .Select(x => new BurialPlaceViewModel(
                                                                                   x,
                                                                                   listDeadPerson.Find(y => y.BurialPlaceID.Equals(x.BurialPlaceID))))
                                                                       .ToList();

                repBurialPlace.DataSource = listBurialPlaceViewModel;
                repBurialPlace.DataBind();
            }
            catch (Exception ex) { }
        }
コード例 #2
0
ファイル: Service1.cs プロジェクト: mnowacki07/CemeterySystem
        private void Tick(object sender, ElapsedEventArgs a)
        {
            DateTime dateNow = DateTime.Today;

            // where the payment period is less than 30 days
            DateTime compareDate = dateNow.AddDays(30);

            List <BurialPlace> listPlaces = new BurialPlaceService().getBy(x => x.PaymentDate <= compareDate);

            List <Guid>       listPlacesId   = listPlaces.Select(x => x.BurialPlaceID).ToList();
            List <DeadPerson> listDeadPerson = new DeadPersonService().getBy(x => listPlacesId.Contains(x.BurialPlaceID));
            List <Guid?>      listFamilyId   = listDeadPerson.Select(x => x.FamilyMemberID).ToList();

            List <ApplicationUser> listUser = new UserService().getBy(x => listFamilyId.Contains(x.FamilyMemberID));


            List <String> emails = listUser.Select(x => x.Email).ToList();


            EmailService service = new EmailService();

            service.sendMail(emails);
        }