Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            btnAddToFav.Src = "Images/star.png";

            var churchId = 0;

            if (Request["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();

            var churches = service.Find(churchId);

            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;
            churchWebsite.InnerHtml     = "Website: " + 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.Now.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.Now.DayOfWeek;

            churchMassLanguages.Attributes.Add("style", "display: none;");
            if (massSchedules.Count > 0)
            {
                massDate = DateTime.Now.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 slider = new ImageSlider();

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

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

                cssSlider.InnerHtml = slider.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;
        }
Ejemplo n.º 2
0
        private void CreateView()
        {
            _scrollView = null;
            _borderView = null;
            View        = new UIView(new CGRect(0, 0, 600, 600))
            {
                BackgroundColor   = Consts.ColorMainBg,
                ContentMode       = UIViewContentMode.ScaleToFill,
                AutoresizingMask  = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                AutosizesSubviews = true
            };

            #region main info
            _mainInfo = new UIView();
            //manufacture
            _manufactureLabel = new UILabel()
            {
                TextColor     = Consts.ColorGray,
                Font          = UIFont.FromName(Consts.FontNameRegular, 20),
                TextAlignment = UITextAlignment.Left,
                Lines         = 0,
                LineBreakMode = UILineBreakMode.WordWrap,
            };
            _mainInfo.Add(_manufactureLabel);
            //title
            _titleLabel = new UILabel(new CGRect(0, 5, 295, 40))
            {
                TextColor     = Consts.ColorBlack,
                Font          = UIFont.FromName(Consts.FontNameBold, 20),
                TextAlignment = UITextAlignment.Left,
                Lines         = 0,
                LineBreakMode = UILineBreakMode.WordWrap,
            };
            _mainInfo.AddSubview(_titleLabel);
            //slider
            _imageSlider = new ImageSlider()
            {
                BackgroundColor = Consts.ColorMainBg
            };
            foreach (var img in DetailViewModel.Product.Images)
            {
                _imageSlider.AddImage(UIImage.FromFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), img)));
            }
            _mainInfo.Add(_imageSlider);
            //price
            _listPriceLable = new UILabel(new RectangleF(0, 5, 50, 20))
            {
                TextColor     = Consts.ColorDarkLight,
                Font          = UIFont.FromName(Consts.FontNameRegular, 16),
                TextAlignment = UITextAlignment.Center,
            };
            _mainInfo.Add(_listPriceLable);
            _profitPriceLabel = new UILabel(new RectangleF(0, 5, 50, 30))
            {
                TextColor       = UIColor.White,
                Font            = UIFont.FromName(Consts.FontNameRegular, 14),
                TextAlignment   = UITextAlignment.Center,
                BackgroundColor = Consts.ColorRed
            };
            _mainInfo.Add(_profitPriceLabel);
            _salePriceLable = new UILabel(new RectangleF(0, 5, 50, 30))
            {
                TextColor     = Consts.ColorDark,
                Font          = UIFont.FromName(Consts.FontNameBold, 22),
                TextAlignment = UITextAlignment.Center,
            };
            _mainInfo.Add(_salePriceLable);
            #endregion

            #region Detail info
            _detailView = new UIView();

            //description
            _descriptionLabel = new UILabel(new RectangleF(0, 0, 295, 200))
            {
                Font          = UIFont.FromName(Consts.FontNameRegular, 17),
                TextAlignment = UITextAlignment.Left,
                TextColor     = Consts.ColorBlack,
                Lines         = 0,
                LineBreakMode = UILineBreakMode.WordWrap,
            };
            _detailView.AddSubview(_descriptionLabel);
            //tabbed
            _segmentControl = new Controls.UISimpleSegments(new CGRect(0, 0, 250, 50));
            _segmentControl.AddSegment("Properties");
            _segmentControl.AddSegment("Description");
            _segmentControl.ChangeSegment += ChangeSegment;
            _detailView.AddSubviews(_segmentControl);
            //properties
            _propertiesTable = new UITableView();
            _propertiesTable.BackgroundColor = Consts.ColorMainBg;
            _propertiesTable.ScrollEnabled   = true;
            _propertiesTable.Source          = new PropertiesSource(DetailViewModel.Product.Properties.Select(x => new KeyValuePair <string, string>(x.DisplayName, x.Value)).ToList());
            _propertiesTable.RowHeight       = PropertyCell.CellHeight;
            _propertiesTable.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            _propertiesTable.ReloadData();
            _detailView.AddSubview(_propertiesTable);
            //add to cart item
            _cartButton = Helpers.UICreator.CreateSimpleButton("Add to cart");
            _detailView.AddSubview(_cartButton);

            #endregion
            //cart button
            _cartOpenButton = new UIBarButtonItem("Cart", UIBarButtonItemStyle.Plain, (s, e) => { DetailViewModel.OpenCartCommad.Execute(); });
            NavigationItem.RightBarButtonItem = _cartOpenButton;
            if (_deviceOrientation == UIInterfaceOrientation.Portrait || _deviceOrientation == UIInterfaceOrientation.PortraitUpsideDown)
            {
                _scrollView = new UIScrollView();
                _scrollView.AddSubviews(_mainInfo, _detailView);
                View.Add(_scrollView);
            }
            else
            {
                View.AddSubviews(_mainInfo, _detailView);
                _borderView = new UIView
                {
                    BackgroundColor = Consts.ColorGray
                };
                Add(_borderView);
            }
            //bindings
            var set = this.CreateBindingSet <DetailProductView, DetailProductViewModel>();
            set.Bind(_titleLabel).To(x => x.Product.Name);
            set.Bind(_descriptionLabel).To(x => x.ProductDescription);
            set.Bind(_salePriceLable).To(x => x.Product.Price.FormattedSalePriceFull);
            set.Bind(NavigationItem).For(x => x.Title).To(x => x.Product.Name);
            set.Bind(_listPriceLable).For(x => x.AttributedText).To(x => x.Product.Price.FormattedListPriceFull).WithConversion(new StrikeTextConvertor());
            set.Bind(_manufactureLabel).For(x => x.Text).To(x => x.Product.Manufacture);
            set.Bind(_profitPriceLabel).For(x => x.Text).To(x => x.Product.Price).WithConversion(new ProfitConvertor());
            set.Bind(_descriptionLabel).For(x => x.Hidden).To(x => x.HideDescription);
            set.Bind(_propertiesTable).For(x => x.Hidden).To(x => x.HideProperties);
            set.Bind(_cartButton).To(x => x.AddToCartCommand);
            set.Bind(_cartOpenButton).For(x => x.Title).To(x => x.CountInCart);
            set.Apply();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var organizationId = 0;
            if (Request["id"] == null && Page.RouteData.Values["organization-id"] == null)
                return;

            if (Request["id"] != null)
                organizationId = Convert.ToInt32(Request["id"]);
            else if (Page.RouteData.Values["organization-id"] != null)
                organizationId = Convert.ToInt32(Page.RouteData.Values["organization-id"]);

            var organizationService = new OrganizationService();

            var organization = organizationService.Find(organizationId);
            var todayMass = organization.Masses
                .Where(mass => mass.ScheduleId == (int) DateTime.Now.DayOfWeek + 1)
                .ToList();

            OrganizationId.Value = organization.Id.ToString();
            OrganizationName.InnerHtml = organization.Name;
            OrganizationAbout.InnerHtml = organization.About;
            OrganizationAddress.InnerHtml = organization.Address;
            OrgAddress.InnerHtml = organization.Address;
            var worshipScheduleString = todayMass.Count < 0 ? "No Worship Schedule Available for This Day"
                : DateTime.Now.DayOfWeek + " " + string.Join(", ", todayMass.Select(mass => mass.Time));
            WorshipScheduleToday.InnerHtml = worshipScheduleString;
            ParentOrganization.InnerHtml = organization.ParentOrganization;
            LastUpdated.InnerHtml = organization.LastUpdate.ToString("MMMM dd, yyyy");
            Location.InnerHtml = organization.Branch;
            InfoOrganizationName.InnerHtml = organization.Name;
            InfoParentOrganization.InnerHtml = organization.ParentOrganization;
            DateEstablished.InnerHtml = organization.DateEstablished;
            ContactNumber.InnerHtml = organization.ContactNumber;
            Email.InnerHtml = organization.Email;
            Website.InnerHtml = organization.Website;
            latitude.Value = organization.Latitude.ToString();
            longitude.Value = organization.Longitude.ToString();
            organizationMapDestination.Value = organization.Address;

            RetreatSchedule.InnerHtml = organization.RetreatSchedule;
            RecollectionSchedule.InnerHtml = organization.RecollectionSchedule;
            TalkSchedule.InnerHtml = organization.TalkSchedule;
            CampSchedule.InnerHtml = organization.CampSchedule;
            VolunteerSchedule.InnerHtml = organization.VolunteerSchedule;


            foreach (var activity in organization.Activities)
                Activities.InnerHtml += new CheckLabel(activity).ToHtml();

            foreach (var attendee in organization.Attendees)
                Attendees.InnerHtml += new CheckLabel(attendee).ToHtml();

            foreach (var location in organization.Locations)
                Venues.InnerHtml += new CheckLabel(location).ToHtml();

            foreach (var ventilation in organization.Ventilations)
                Ventilations.InnerHtml += new CheckLabel(ventilation).ToHtml();

            foreach (var parking in organization.Parkings)
                Parkings.InnerHtml += new CheckLabel(parking).ToHtml();

            foreach (var mass in organization.Masses)
                MassSchedule.Controls.Add(new HtmlGenericControl("li") {InnerHtml = mass.Time});

            foreach (var bibleSchedule in organization.BibleStudySchedules)
                BibleSchedule.Controls.Add(new HtmlGenericControl("li") {InnerHtml = bibleSchedule.Time});

            foreach (var worshipSchedule in organization.WorshipSchedules)
                WorshipSchedule.Controls.Add(new HtmlGenericControl("li") {InnerHtml = worshipSchedule.Time});

            var slider = new ImageSlider();

            if (organization.Photos.Count > 0)
            {
                slider.FirstImage = organization.Photos[0];

                for (var i = 0; i < organization.Photos.Count; i++)
                    slider.AddImage(i, organization.Photos[i]);

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

            var reviews = new OrganizationReviewService().Get(organization.Id);

            foreach (var review in reviews)
            {
                var reviewItem = new Components.OrganizationReview(review);

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

            Page.Title = organization.Name;

            if (Auth.Check())
            {
                var favoriteService = new FavoritesService();
                if (favoriteService.IsOrganizationAlreadyInFavorites(Auth.user().Id, organization.Id))
                {
                    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");
            }

            var announcementService = new OrganizationAnnouncementService();
            var announcements = announcementService.Get(organization.Id);

            foreach (Models.OrganizationAnnouncement announcement in announcements)
            {
                var component = new Components.OrganizationAnnouncement(announcement);

                announcementContainer.InnerHtml += component.ToHtml();
            }
        }