Example #1
0
        public IHttpActionResult GetChurchByID(int id)
        {
            ChurchService churchService = new ChurchService();
            var           church        = churchService.GetChurchByID(id);

            return(Ok(church));
        }
Example #2
0
        public ChurchServiceTests()
        {
            _manager = new Manager();
            var repo = new ChurchRepository(_manager.Db);

            Service = new ChurchService(repo);
        }
 public PartnershipSummaryReportBuilder(CurrencyService currencyService, ChurchService churchService,
     IRepository<Partnership> repository)
 {
     _service = currencyService;
     _churchService = churchService;
     _repository = repository;
 }
Example #4
0
        public IHttpActionResult Get()
        {
            ChurchService churchService = new ChurchService();
            var           churches      = churchService.GetChurch();

            return(Ok(churches));
        }
Example #5
0
        public IHttpActionResult Delete(int id)
        {
            var service = new ChurchService();

            if (!service.DeleteChurch(id))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Example #6
0
        public IHttpActionResult Put(ChurchEdit church)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = new ChurchService();

            if (!service.EditChurch(church))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
        public static List <ChurchInfo> GetChurchesNearby(double latitude, double longitude)
        {
            ChurchService service = new ChurchService();
            Coordinate    source  = new Coordinate()
            {
                Latitude = latitude, Longitude = longitude
            };

            List <ChurchInfo> coordinates = service.GetCoordinates(new Coordinate()
            {
                Latitude = Math.Truncate(latitude), Longitude = Math.Truncate(longitude)
            });

            return(coordinates.OrderBy(coordinate => NearDistance(source, new Coordinate()
            {
                Latitude = coordinate.Latitude, Longitude = coordinate.Longitude
            })).ToList <ChurchInfo>());
        }
Example #8
0
        protected void Page_Init(object sender, EventArgs e)
        {
            GoogleMetaDescription = "Your single access to all your catholic needs.";
            if (Page.RouteData.Values["bible-verse-id"] != null)
            {
                var bibleVerseService = new BibleVerseService();

                var verse = bibleVerseService.Find(Convert.ToInt32(Page.RouteData.Values["bible-verse-id"]));

                MetaDescription       = verse.BibleVerseContent;
                GoogleMetaDescription = MetaDescription;
                MetaTitle             = "Bible Verse";
                MetaUrl   = "http://www.mycatholicportal.org/BibleVerse.aspx";
                MetaImage = "http://www.mycatholicportal.org/Images/BibleVerse.png";
            }

            if (Page.RouteData.Values["religious-quote-id"] != null)
            {
                var religiousQuoteService = new ReligiousQuoteService();

                var religiousQuote =
                    religiousQuoteService.Find(Convert.ToInt32(Page.RouteData.Values["religious-quote-id"]));

                MetaDescription       = religiousQuote.Quote;
                GoogleMetaDescription = MetaDescription;
                MetaTitle             = "Religious Quote";
                MetaUrl   = "http://www.mycatholicportal.org/ReligiousQuote.aspx";
                MetaImage = "http://www.mycatholicportal.org/Images/RelQuotes.png";
            }

            if (Page.RouteData.Values["music-id"] != null)
            {
                var musicalInspirationService = new MusicalInspirationService();

                var music =
                    musicalInspirationService.Find(Convert.ToInt32(Page.RouteData.Values["music-id"]));

                MetaDescription       = "Currently playing " + music.SongTitle + " by " + music.Artist;
                GoogleMetaDescription = MetaDescription;
                MetaTitle             = "Musical Inspiration";
                MetaUrl   = "http://www.mycatholicportal.org/MusicalInspirations.aspx";
                MetaImage = "http://www.mycatholicportal.org/Images/Musical.png";
            }

            if (Page.RouteData.Values["church-id"] != null)
            {
                var churchService = new ChurchService();

                var church = churchService.Find(Convert.ToInt32(Page.RouteData.Values["church-id"]));

                char[] separator = { ',' };
                MetaTitle             = church.Parish;
                MetaDescription       = church.ChurchHistory.Split(separator)[0];
                GoogleMetaDescription = MetaDescription;
                MetaUrl   = "http://www.mycatholicportal.org/Church/" + church.SimbahanID;
                MetaImage = church.ChurchPhotos.Count > 0
                    ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos
                    : "";
            }

            if (Page.RouteData.Values["organization-id"] != null)
            {
                var organizationService = new OrganizationService();

                var church = organizationService.Find(Convert.ToInt32(Page.RouteData.Values["organization-id"]));

                char[] separator = { ',' };
                MetaTitle       = church.Name;
                MetaDescription = "";
                MetaUrl         = "http://www.mycatholicportal.org/Organization/" + church.Id;
                MetaImage       = "";
            }

            if (Page.RouteData.Values["devote-id"] != null)
            {
                var devotionService = new DevotionService();

                var devotion = devotionService.Find(Convert.ToInt32(Page.RouteData.Values["devote-id"]));

                char[] separator = { ',' };
                MetaTitle             = devotion.Title;
                MetaDescription       = devotion.Prayer.Split(separator)[0];
                GoogleMetaDescription = MetaDescription;
                MetaUrl = "http://www.mycatholicportal.org/Dvote/" + devotion.Id;
                //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : "";
            }

            if (Page.RouteData.Values["prayer-id"] != null)
            {
                var bcpService = new BasicCatholicPrayerService();

                var bcp = bcpService.Find(Convert.ToInt32(Page.RouteData.Values["prayer-id"]));

                char[] separator = { ',' };
                MetaTitle             = bcp.Title;
                MetaDescription       = bcp.Prayer.Split(separator)[0];
                GoogleMetaDescription = MetaDescription;
                MetaUrl = "http://www.mycatholicportal.org/Prayer/" + bcp.Id;
                //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : "";
            }

            if (Page.RouteData.Values["other-prayer-id"] != null)
            {
                var ocpService = new OtherCatholicPrayerService();

                var ocp = ocpService.Find(Convert.ToInt32(Page.RouteData.Values["other-prayer-id"]));

                char[] separator = { ',' };
                MetaTitle             = ocp.Title;
                MetaDescription       = ocp.Prayer.Split(separator)[0];
                GoogleMetaDescription = MetaDescription;
                MetaUrl = "http://www.mycatholicportal.org/OtherPrayer/" + ocp.Id;
                //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : "";
            }

            if (Page.RouteData.Values["saint-id"] != null)
            {
                var saintService = new SaintService();

                var saint = saintService.Find(Convert.ToInt32(Page.RouteData.Values["saint-id"]));

                MetaTitle             = saint.Name;
                MetaDescription       = saint.Biography;
                GoogleMetaDescription = MetaDescription;
                MetaUrl = "http://www.mycatholicportal.org/Saint/" + saint.Id;
            }

            if (Page.RouteData.Values["gospel-id"] != null)
            {
                var dailyGospelService = new DailyGospelService();
                int id;
                Models.DailyGospel gospel;

                if (int.TryParse(Page.RouteData.Values["gospel-id"].ToString(), out id))
                {
                    gospel = dailyGospelService.Find(id);
                }
                else if (Page.RouteData.Values["gospel-id"].ToString().Length > 1)
                {
                    gospel = dailyGospelService.FindByDate(Convert.ToDateTime(Page.RouteData.Values["gospel-id"]));
                }
                else
                {
                    gospel = dailyGospelService.FindByDate(DateTime.Now);
                }

                MetaDescription       = gospel.FirstReadingContent;
                GoogleMetaDescription = MetaDescription;
                MetaTitle             = "Daily Gospel";
                MetaUrl   = "http://www.mycatholicportal.org/Gospel/" + gospel.Id;
                MetaImage = "http://www.mycatholicportal.org/Images/dailyreadings.jpg";
            }

            if (Page.RouteData.Values["daily-reflection-id"] != null)
            {
                var reflectionService = new DailyReflectionService();
                int id;
                Models.DailyReflection reflection;

                if (int.TryParse(Page.RouteData.Values["daily-reflection-id"].ToString(), out id))
                {
                    reflection = reflectionService.Find(id);
                }
                else if (Page.RouteData.Values["daily-reflection-id"].ToString().Length > 1)
                {
                    reflection =
                        reflectionService.FindByDate(Convert.ToDateTime(Page.RouteData.Values["daily-reflection-id"]));
                }
                else
                {
                    reflection = reflectionService.FindByDate(DateTime.Now);
                }

                MetaDescription       = reflection.FirstContentTitle;
                GoogleMetaDescription = MetaDescription;
                MetaTitle             = "Daily Reflection";
                MetaImage             = "http://www.mycatholicportal.org/Images/dailyreadings.jpg";
                MetaUrl = "http://www.mycatholicportal.org/Reflection/" + reflection.Id;
            }

            if (Page.RouteData.Values["announcement-id"] != null)
            {
                var announcementService = new AnnouncementService();

                var announcement = announcementService.Find(Convert.ToInt32(Page.RouteData.Values["announcement-id"]));

                char[] separator = { ',' };
                MetaTitle             = announcement.Title;
                MetaDescription       = announcement.Description;
                GoogleMetaDescription = MetaDescription;
                MetaUrl = "http://www.mycatholicportal.org/Announcement/" + announcement.Id;
                //MetaImage = church.ChurchPhotos.Count > 0 ? "http://www.mycatholicportal.org/Images/" + church.ChurchPhotos[0].ChurchPhotos : "";
            }

            // The code below helps to protect against XSRF attacks
            var  requestCookie = Request.Cookies[AntiXsrfTokenKey];
            Guid requestCookieGuidValue;

            if (requestCookie != null && Guid.TryParse(requestCookie.Value, out requestCookieGuidValue))
            {
                // Use the Anti-XSRF token from the cookie
                _antiXsrfTokenValue   = requestCookie.Value;
                Page.ViewStateUserKey = _antiXsrfTokenValue;
            }
            else
            {
                // Generate a new Anti-XSRF token and save to the cookie
                _antiXsrfTokenValue   = Guid.NewGuid().ToString("N");
                Page.ViewStateUserKey = _antiXsrfTokenValue;

                var responseCookie = new HttpCookie(AntiXsrfTokenKey)
                {
                    HttpOnly = true,
                    Value    = _antiXsrfTokenValue
                };
                if (FormsAuthentication.RequireSSL && Request.IsSecureConnection)
                {
                    responseCookie.Secure = true;
                }
                Response.Cookies.Set(responseCookie);
            }

            Page.PreLoad += master_Page_PreLoad;
        }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnAddToFav.Src = "http://" + HttpContext.Current.Request.Url.Host + "/Images/star.png";

            var churchId = 0;

            Sample();



            if (Request["id"] == null && Page.RouteData.Values["church-id"] == null && Page.RouteData.Values["church-id"] == null)
            {
                return;
            }

            if (Request["id"] != null)
            {
                churchId = Convert.ToInt32(Request["id"]);
            }
            else if (Page.RouteData.Values["church-id"] != null)
            {
                churchId = Convert.ToInt32(Page.RouteData.Values["church-id"]);
            }



            var service = new ChurchService();

            var favoriteService = new FavoritesService();

            var timeStandard = new TimeStandard();

            churches = service.Find(churchId);

            Master.MetaTitle       = $"{churches.MetaTitle}";
            Master.MetaDescription = $"{churches.MetaDescription}";

            maskData.Value             = churches.MaskData;
            simbahanID.Value           = churchId.ToString();
            churchName.InnerHtml       = churches.Parish;
            churchAddress.InnerHtml    = churches.CompleteAddress;
            churchLastUpdate.InnerHtml = churches.LastUpdate.ToString("MMM d, yyyy");
            churchHistory.InnerHtml    = HttpUtility.HtmlDecode(churches.ChurchHistory) == ""
                ? "<h3>No Data Available.</h3>"
                : "<strong>" + churches.Parish + "</strong> " + HttpUtility.HtmlDecode(churches.ChurchHistory);
            churchType.InnerHtml        = ChurchType.parseInt(churches.ChurchTypeID);
            churchEstablished.InnerHtml = churches.DateEstablished;
            churchFeastDay.InnerHtml    = churches.FeastDay;
            churchPriest.InnerHtml      = churches.Priest;
            churchVicariate.InnerHtml   = churches.Vicariate;
            churchDiocese.InnerHtml     = churches.Diocese;
            churchContact.InnerHtml     = churches.ContactNo;
            churchWeb.HRef              = "http://www." + churches.Website;
            churchWebsite.InnerHtml     = churches.Website;
            adorationSchedule.InnerHtml = churches.AdorationDisplayText;
            churchMapAddress.InnerHtml  = churches.CompleteAddress;
            churchMapDestination.Value  = churches.CompleteAddress;

            baptismSchedule.InnerHtml  = churches.BaptismDetails;
            weddingSchedule.InnerHtml  = churches.WeddingDetails;
            officeHours.InnerHtml      = churches.OfficeHours;
            devotionSchedule.InnerHtml = churches.DevotionSchedule;
            latitude.Value             = churches.Latitude.ToString();
            longitude.Value            = churches.Longitude.ToString();

            editChurchHistory.InnerHtml = churches.ChurchHistory;

            if (Auth.Check())
            {
                if (favoriteService.IsChurchAlreadyInFavorites(Auth.user().Id, churches.SimbahanID))
                {
                    AddFav.Attributes.Add("style", "display: none;");
                    RemoveFav.Attributes.Add("style", "display: block;");
                }
                else
                {
                    AddFav.Attributes.Add("style", "display: block;");
                    RemoveFav.Attributes.Add("style", "display: none;");
                }
            }
            else
            {
                RemoveFav.Attributes.Add("style", "display: none");
            }

            List <MassDetailsModel> schedules;


            switch (DateTime.UtcNow.DayOfWeek)
            {
            case DayOfWeek.Sunday:
                schedules = churches.SundayMassSchedule;
                break;

            case DayOfWeek.Monday:
                schedules = churches.MondayMassSchedule;
                break;

            case DayOfWeek.Tuesday:
                schedules = churches.TuesdayMassSchedule;
                break;

            case DayOfWeek.Wednesday:
                schedules = churches.WednesdayMassSchedule;
                break;

            case DayOfWeek.Thursday:
                schedules = churches.ThursdayMassSchedule;
                break;

            case DayOfWeek.Friday:
                schedules = churches.FridayMassSchedule;
                break;

            case DayOfWeek.Saturday:
                schedules = churches.SaturdayMassSchedule;
                break;

            default:
                schedules = new List <MassDetailsModel>();
                break;
            }

            var languages     = new List <string>();
            var massSchedules = new List <string>();

            foreach (var mass in schedules)
            {
                if (mass.Language != "" && !languages.Contains(mass.Language))
                {
                    languages.Add(mass.Language);
                }

                massSchedules.Add(mass.Time);
            }

            var massDate = "No Mass Schedule for " + DateTime.UtcNow.DayOfWeek;

            churchMassLanguages.Attributes.Add("style", "display: none;");
            if (massSchedules.Count > 0)
            {
                massDate = DateTime.UtcNow.DayOfWeek + " - " + string.Join(", ", massSchedules);
                churchMassLanguages.Attributes.Add("style", "display: block;");
            }

            churchMassDates.InnerHtml     = massDate;
            churchMassLanguages.InnerHtml = string.Join(", ", languages);

            adorationChapelSchedule.InnerHtml = churches.AdorationDisplayText;

            confessionSchedule.InnerHtml = churches.ConfessionDetails.Count > 0
                ? churches.ConfessionDetails[0].Text
                : "";

            if (!string.IsNullOrEmpty(churches.LocationType))
            {
                var locationLabel = new CheckLabel(churches.LocationType);
                churchLocation.InnerHtml = locationLabel.ToHtml();
            }

            foreach (var ventilation in churches.Ventilations)
            {
                var ventilationLabel = new CheckLabel(ventilation.VentType);

                churchVentilations.InnerHtml += ventilationLabel.ToHtml();
            }

            foreach (var ventilation in churches.AdorationVentilations)
            {
                var ventilationLabel = new CheckLabel(ventilation);

                adorationVentilations.InnerHtml += ventilationLabel.ToHtml();
            }

            foreach (var parking in churches.ChurchParking)
            {
                var parkingLabel = new CheckLabel(parking.ParkingType);

                churchParking.InnerHtml += parkingLabel.ToHtml();
            }

            for (var i = 5; i <= 22; i++)
            {
                var row = new HtmlTableRow();

                var dayTime       = new HtmlTableCell();
                var sundayMass    = new HtmlTableCell();
                var mondayMass    = new HtmlTableCell();
                var tuesdayMass   = new HtmlTableCell();
                var wednesdayMass = new HtmlTableCell();
                var thursdayMass  = new HtmlTableCell();
                var fridayMass    = new HtmlTableCell();
                var saturdayMass  = new HtmlTableCell();

                var sundayTime    = churches.SundayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var mondayTime    = churches.MondayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var tuesdayTime   = churches.TuesdayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var wednesdayTime =
                    churches.WednesdayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var thursdayTime =
                    churches.ThursdayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var fridayTime   = churches.FridayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);
                var saturdayTime =
                    churches.SaturdayMassSchedule.FirstOrDefault(schedule => schedule.TimeStandardId == i);

                dayTime.InnerHtml = timeStandard.Time[i - 1];

                sundayMass.InnerHtml =
                    sundayTime != null ? sundayTime.Time + "<br/>" + sundayTime.Language : "";

                mondayMass.InnerHtml =
                    mondayTime != null ? mondayTime.Time + "<br/>" + mondayTime.Language : "";

                tuesdayMass.InnerHtml =
                    tuesdayTime != null ? tuesdayTime.Time + "<br/>" + tuesdayTime.Language : "";

                wednesdayMass.InnerHtml =
                    wednesdayTime != null ? wednesdayTime.Time + "<br/>" + wednesdayTime.Language : "";

                thursdayMass.InnerHtml =
                    thursdayTime != null ? thursdayTime.Time + "<br/>" + thursdayTime.Language : "";

                fridayMass.InnerHtml =
                    fridayTime != null ? fridayTime.Time + "<br/>" + fridayTime.Language : "";

                saturdayMass.InnerHtml =
                    saturdayTime != null ? saturdayTime.Time + "<br/>" + saturdayTime.Language : "";

                row.Cells.Add(dayTime);
                row.Cells.Add(sundayMass);
                row.Cells.Add(mondayMass);
                row.Cells.Add(tuesdayMass);
                row.Cells.Add(wednesdayMass);
                row.Cells.Add(thursdayMass);
                row.Cells.Add(fridayMass);
                row.Cells.Add(saturdayMass);
                row.Attributes.Add("class", "text-center");

                massScheduleTable.Rows.Add(row);
            }

            if (churches.Announcements.Count > 0)
            {
                foreach (var announcement in churches.Announcements)
                {
                    var announcementControl = new Components.Announcement(announcement);

                    churchAnnouncementContainer.InnerHtml += announcementControl.ToHtml();
                }
            }
            else
            {
                churchAnnouncementContainer.InnerHtml += "<h4>No Announcement Found.</h4>";
            }

            foreach (var review in churches.ChurchReviews)
            {
                var reviewItem = new Components.ChurchReview(review);

                churchReviewsContainer.InnerHtml += reviewItem.ToHtml();
            }


            //var path = HttpContext.Current.Request.Url.AbsolutePath;
            //string[] QueryArray = path.Split('/');
            //var newPath = QueryArray[1];
            //var root = QueryArray[0];

            //if (newPath == "Churches")
            //{
            //    ResolveUrl("Churches.aspx");
            //    var carousel = new Carousel();

            //    if (churches.ChurchPhotos.Count > 0)
            //    {
            //        //carousel.FirstImage = churches.ChurchPhotos[0].ChurchPhotos;

            //        for (var i = 0; i < churches.ChurchPhotos.Count; i++)
            //            carousel.AddImage(i, churches.ChurchPhotos[i].ChurchPhotos);

            //        cssSlider.InnerHtml = carousel.ToHtml();
            //    }
            //    else
            //    {
            //        cssSlider.InnerHtml = "<h3 class=\"text-center\">No Photos Available.</h3>";
            //    }

            //} else
            //{

            var carousel = new Carousel();

            if (churches.ChurchPhotos.Count > 0)
            {
                //carousel.FirstImage = churches.ChurchPhotos[0].ChurchPhotos;

                for (var i = 0; i < churches.ChurchPhotos.Count; i++)
                {
                    carousel.AddImage(i, churches.ChurchPhotos[i].ChurchPhotos);
                }

                cssSlider.InnerHtml = carousel.ToHtml();
            }
            else
            {
                cssSlider.InnerHtml = "<h3 class=\"text-center\">No Photos Available.</h3>";
            }
            //}


            if (churches.AdorationPhotos.Count > 0)
            {
                for (var i = 0; i < churches.AdorationPhotos.Count; i++)
                {
                    var imagePath = ResolveUrl(churches.AdorationPhotos[i]);

                    var newLi = new HtmlGenericControl("li")
                    {
                        InnerHtml = "<img src=\"" + imagePath +
                                    "\" alt=\"\" title=\"\" id=\"wows1_" + i + "\" />"
                    };
                    adorationImageList.Controls.Add(newLi);

                    var newA = new HtmlGenericControl("a");
                    newA.Attributes.Add("href", "#");
                    newA.InnerHtml = "<a href=\"#\" title=\"\"><span><img src=\"" + imagePath +
                                     "\" alt=\"\" />" + (i + 1) + "</span></a>";
                    adorationLinkList.Controls.Add(newA);
                }
            }
            else
            {
                adorationImageContainer.InnerHtml = "<h3>No Photos Available</h3>";
            }

            Master.GoogleMetaDescription = massDate;
            Page.Title = churches.Parish;
        }
 public PartnersRankingBuilder(ChurchService churchService, CurrencyService currencyService, IRepository<Partnership> repository)
 {
     _churchService = churchService;
     _currencyService = currencyService;
     _repository = repository;
 }
Example #11
0
        public static List <ChurchInfo> GetChurches(string churchKeyword, string churchLocation,
                                                    string selectChurchSchedule, string selectChurchMassTime,
                                                    string selectChurchLanguage, string selectChurchConfessionDay,
                                                    string selectChurchConfessionTime, bool churchHasAirConditioned, bool churchHasCeilingFan,
                                                    bool churchHasOrdinaryFan, string churchType, string churchLocationId,
                                                    bool churchHasStreetParking, bool churchHasMallParking, bool churchHasPrivateParking,
                                                    double latitude, double longitude, int limit, int page, int radius)
        {
            var service = new ChurchService();

            var ventilationList = new List <string>();
            var parkingList     = new List <string>();

            if (churchHasAirConditioned)
            {
                ventilationList.Add("1");
            }

            if (churchHasCeilingFan)
            {
                ventilationList.Add("2");
            }

            if (churchHasOrdinaryFan)
            {
                ventilationList.Add("3");
            }

            var ventilations = string.Join(",", ventilationList);

            if (churchHasPrivateParking)
            {
                parkingList.Add("1");
            }

            if (churchHasMallParking)
            {
                parkingList.Add("2");
            }

            if (churchHasStreetParking)
            {
                parkingList.Add("3");
            }

            var parkings = string.Join(",", parkingList);

            if (selectChurchSchedule == "8")
            {
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                    selectChurchSchedule = "1";
                    break;

                case DayOfWeek.Monday:
                    selectChurchSchedule = "2";
                    break;

                case DayOfWeek.Tuesday:
                    selectChurchSchedule = "3";
                    break;

                case DayOfWeek.Wednesday:
                    selectChurchSchedule = "4";
                    break;

                case DayOfWeek.Thursday:
                    selectChurchSchedule = "5";
                    break;

                case DayOfWeek.Friday:
                    selectChurchSchedule = "6";
                    break;

                default:
                    selectChurchSchedule = "7";
                    break;
                }
            }

            if (selectChurchConfessionDay == "8")
            {
                switch (DateTime.Now.DayOfWeek)
                {
                case DayOfWeek.Sunday:
                    selectChurchConfessionDay = "1";
                    break;

                case DayOfWeek.Monday:
                    selectChurchConfessionDay = "2";
                    break;

                case DayOfWeek.Tuesday:
                    selectChurchConfessionDay = "3";
                    break;

                case DayOfWeek.Wednesday:
                    selectChurchConfessionDay = "4";
                    break;

                case DayOfWeek.Thursday:
                    selectChurchConfessionDay = "5";
                    break;

                case DayOfWeek.Friday:
                    selectChurchConfessionDay = "6";
                    break;

                default:
                    selectChurchConfessionDay = "7";
                    break;
                }
            }

            var churches = service.Search(churchKeyword, "", churchType, churchLocationId, "",
                                          selectChurchSchedule,
                                          selectChurchMassTime, selectChurchLanguage, selectChurchConfessionTime,
                                          selectChurchConfessionDay, ventilations, parkings, "");

            if (churchLocation.IsNullOrWhiteSpace())
            {
                return(churches);
            }

            return(churches
                   .Where(coordinate => WithinRadius(NearDistance(new Coordinate {
                Latitude = latitude, Longitude = longitude
            },
                                                                  new Coordinate {
                Latitude = coordinate.Latitude, Longitude = coordinate.Longitude
            }), radius))
                   .OrderBy(coordinate => NearDistance(new Coordinate {
                Latitude = latitude, Longitude = longitude
            },
                                                       new Coordinate {
                Latitude = coordinate.Latitude, Longitude = coordinate.Longitude
            }))
                   .ToList());
        }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            int simbahanId = Convert.ToInt32(Request["id"]);

            using (SqlConnection dbconn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString))
            {
                if (dbconn.State == ConnectionState.Open)
                {
                    dbconn.Close();
                }
                dbconn.Open();

                //Table Simabahan
                //using (SqlCommand cmd = new SqlCommand("SELECT SimbahanID, Parish, CompleteAddress, City, StateOrProvince, Vicariate, FeastDay, ParishPriest, Diocese, DateEstablished, ContactNo, EmailAddress, Website, LocationID, HasAdorationChapel, OfficeHours, DevotionSchedule FROM Simbahan where SimbahanID = " + simbahanId, dbconn))
                //using (SqlDataAdapter adapter = new SqlDataAdapter(cmd))
                var churchService = new ChurchService();
                var church        = churchService.Find(simbahanId);
                //using (DataTable table = new DataTable())

                {
                    //adapter.Fill(table);
                    try
                    {
                        churchName.Value      = church.Parish;
                        address.Value         = church.CompleteAddress;
                        city.Value            = church.City;
                        province.Value        = church.StateProvince;
                        vicariate.Value       = church.Vicariate;
                        feastDay.Value        = church.FeastDay;
                        parishPriest.Value    = church.Priest;
                        diocese.Value         = church.Diocese;
                        dateEstablished.Value = church.DateEstablished;
                        phoneNo.Value         = church.ContactNo;
                        emailAdd.Value        = church.EmailAddress;
                        website.Value         = church.Website;
                        OfficeSchedule.Value  = church.OfficeHours;
                        SchedOfDevotion.Value = church.DevotionSchedule;

                        int locID;

                        if (Convert.IsDBNull(church.LocationID))
                        {
                            locID = 0;
                        }
                        else
                        {
                            locID = Convert.ToInt32(church.LocationID);
                        }

                        int HasAdo;

                        if (Convert.IsDBNull(church.HasAdorationChapel))
                        {
                            HasAdo = 0;
                        }
                        else
                        {
                            HasAdo = Convert.ToInt32(church.HasAdorationChapel);
                        }

                        //LocationID
                        if (locID == 1)
                        {
                            locSeparate.Checked = true;
                        }
                        else if (locID == 2)
                        {
                            locConvent.Checked = true;
                        }
                        else if (locID == 3)
                        {
                            locMall.Checked = true;
                        }
                        else if (locID == 5)
                        {
                            locHospital.Checked = true;
                        }
                        else if (locID == 4)
                        {
                            locSchool.Checked = true;
                        }

                        if (HasAdo == 0)
                        {
                            hasAdoNo.Checked = true;
                        }
                        else if (HasAdo == 1)
                        {
                            hasAdoYes.Checked = true;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
                SimbahanId.Value = simbahanId.ToString();
                SimbahanVentilation();
                SimbahanParking();
                Adoration();
                AdorationVentulation();
                MassDetails();
                ConfessionDetails();
                AdorationDetails();
                BaptismSchedules();
                WeddingSchedules();
                EventDetails();
                adoration();
            }
        }