public void ModelToItem(MonAssoce.Data.Models.Event eventModel)
 {
     dateToStringConverter = new DateToStringConverter();
     this.ID = eventModel.ID;
     if (eventModel.PictureURI.Equals(string.Empty))
     {
         this.Image = DEFAULT_IMAGE_PATH;
     }
     else
     {
         this.Image = eventModel.PictureURI;
     }
     this.Title = eventModel.Title;
     this.Subtitle = dateToStringConverter.ConvertDateToString(eventModel.Date, eventModel.Schedule, true);
     this.ShortSubtitle = dateToStringConverter.ConvertDateToString(eventModel.Date, eventModel.Schedule, false);
     this.Content = eventModel.Description;
     if (eventModel.BigPictureURI != "")
     {
         this.BigPictureURI = eventModel.BigPictureURI;
     }
     else
     {
         this.BigPictureURI = this.Image;
     }
     this.RemotePictureURI = eventModel.RemotePictureURI;
     this.ContactName = eventModel.ContactName;
     this.ContactEmail = eventModel.ContactEmail;
     this.PhoneNumber = eventModel.PhoneNumber;
     this.WebSiteURL = eventModel.WebSiteURL;
     this.Address = eventModel.Address;
 }
 public void ModelToItem(MonAssoce.Data.Models.Member member)
 {
     dateToStringConverter = new DateToStringConverter();
     resourceLoader = new ResourceLoader();
     if (member.PictureURI.Equals(string.Empty))
     {
         this.Image = DEFAULT_IMAGE_PATH;
     }
     else
     {
         this.Image = member.PictureURI;
     }
     this.Title = member.FirstName + " " + member.LastName;
     this.Subtitle = resourceLoader.GetString(MEMBER_SINCE_KEY) + " " + dateToStringConverter.ConvertDateToString(member.MemberSince, false, false);
     this.Email = member.Email;
     this.PhoneNumber = member.PhoneNumber;
     this.WebsiteURL = member.WebSiteURL;
 }
 public void ModelToItem(MonAssoce.Data.Models.News newsModel)
 {
     dateToStringConverter = new DateToStringConverter();
     this.ID = newsModel.ID;
     if (newsModel.ImageURL.Equals(string.Empty))
     {
         this.Image = DEFAULT_IMAGE_PATH;
     }
     else
     {
     this.Image = newsModel.ImageURL;
     }
     this.BigPictureURI = newsModel.BigPictureURI;
     this.RemotePictureURI = newsModel.RemotePictureURI;
     this.Title = newsModel.Title;
     this.Subtitle = dateToStringConverter.ConvertDateToString(newsModel.PubDate, newsModel.Schedule, true);
     this.ShortSubtitle = dateToStringConverter.ConvertDateToString(newsModel.PubDate, newsModel.Schedule, false);
     this.Content = newsModel.Content;
 }
 public void ModelToItem(MonAssoce.Data.Models.Project projectModel)
 {
     dateToStringConverter = new DateToStringConverter();
     this.ID = projectModel.ID;
     if (projectModel.PictureURI.Equals(string.Empty))
     {
         this.Image = DEFAULT_IMAGE_PATH;
     }
     else
     {
         this.Image = projectModel.PictureURI;
     }
     this.Title = projectModel.Title;
     this.Subtitle = projectModel.SubTitle;
     this.Content = projectModel.Description;
     this.BigPictureURI = projectModel.BigPictureURI;
     this.RemotePictureURI = projectModel.RemotePictureURI;
     this.Deadline = dateToStringConverter.ConvertDateToString(projectModel.Deadline, projectModel.Schedule, true);
     this.ContactName = projectModel.ContactName;
     this.ContactEmail = projectModel.ContactEmail;
     this.ContactPhone = projectModel.ContactPhone;
 }
        private ObservableCollection<MainHubViewModel> InitializeHubs(Presentation presentList, List<News> newsList, List<Event> eventList, List<Project> projectList)
        {
            DateToStringConverter dateToStringConverter = new DateToStringConverter();
            MainHubViewModel tempHub = new MainHubViewModel();
            ObservableCollection<MainHubViewModel> tempHubs = new ObservableCollection<MainHubViewModel>();

            #region Presentation formater
            tempHub.ID = tempHub.Count;
            tempHub.HubName = _res.GetString("Presentation");
            tempHub.NbItemsVisibility = Visibility.Collapsed;
            tempHub.Add(new MainItemViewModel()
                            {
                                BigPhoto = presentList.BigPictureURI,
                                IsDescription = true,
                                DescriptionVisibility = Visibility.Visible,
                                OtherVisibility = Visibility.Collapsed,
                                ImageOnlyVisibility = Visibility.Collapsed,
                                Description = presentList.Description,
                                Photo1 = presentList.PicturesURI[0],
                                Photo2 = presentList.PicturesURI[1],
                                Photo3 = presentList.PicturesURI[2]
                            });
            for (int i = 3; i < presentList.PicturesURI.Count; i++)
            {
                    tempHub.Add(new MainItemViewModel()
                    {
                        Photo = presentList.PicturesURI[i],
                        IsDescription = true,
                        DescriptionVisibility = Visibility.Collapsed,
                        OtherVisibility = Visibility.Collapsed,
                        ImageOnlyVisibility = Visibility.Visible
                    });
            }
            tempHubs.Add(tempHub);
            #endregion

            #region News formater
            tempHub = new MainHubViewModel();
            tempHub.ID = tempHubs.Count;
            tempHub.HubName = _res.GetString("NewsPageTitleMain");
            tempHub.NbItems = newsList.Count;
            tempHub.NbItemsVisibility = Visibility.Visible;
            int cpt = 0;
            foreach (News news in newsList)
            {
                string img;
                if (news.ImageURL == "")
                    img = "/Content/Images/News/default.png";
                else
                    img = news.ImageURL;

                    tempHub.Add(new MainItemViewModel()
                    {
                        ID = news.ID,
                        Photo = img,
                        Title = news.Title,
                        Subtitle = dateToStringConverter.ConvertDateToString(news.PubDate, news.Schedule, false),
                        IsDescription = false,
                        LabelImage = "/Content/Images/News/label.png",
                        DescriptionVisibility = Visibility.Collapsed,
                        OtherVisibility = Visibility.Visible,
                        ImageOnlyVisibility = Visibility.Collapsed,
                        IsEvent = false,
                        IsNews = true,
                        IsProject = false
                    });
            }

            tempHubs.Add(tempHub);
            #endregion

            #region Events formater
            tempHub = new MainHubViewModel();
            tempHub.ID = tempHubs.Count;
            tempHub.HubName = _res.GetString("EventsPageTitleMain");
            tempHub.NbItems = eventList.Count;
            tempHub.NbItemsVisibility = Visibility.Visible;
            cpt = 0;
            foreach (Event events in eventList)
            {
                string img;
                if (events.PictureURI == "")
                    img = "/Content/Images/Events/default.png";
                else
                    img = events.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {
                    ID = events.ID,
                    Photo = img,
                    Title = events.Title,
                    Subtitle = dateToStringConverter.ConvertDateToString(events.Date, events.Schedule, false),
                    LabelImage = "/Content/Images/Events/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,   
                    ImageOnlyVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    IsEvent = true,
                    IsNews = false,
                    IsProject = false
                });

                cpt++;
            }

            tempHubs.Add(tempHub);

            #endregion

            #region Projects formater
            tempHub = new MainHubViewModel();
            tempHub.ID = tempHubs.Count;
            tempHub.HubName = _res.GetString("ProjectsPageTitleMain");
            tempHub.NbItems = projectList.Count;
            tempHub.NbItemsVisibility = Visibility.Visible;

            foreach (Project project in projectList)
            {
                string img;
                if (project.PictureURI == "")
                    img = "/Content/Images/Projects/default.png";
                else
                    img = project.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {
                    ID = project.ID,
                    Photo = img,
                    Title = project.Title,
                    Subtitle = project.SubTitle,
                    LabelImage = "/Content/Images/Projects/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    ImageOnlyVisibility = Visibility.Collapsed,
                    IsEvent = false,
                    IsNews = false,
                    IsProject = true
                });

            }

            tempHubs.Add(tempHub);
            #endregion

            return tempHubs;
        }
        private ObservableCollection<MainHubViewModel> MakePresentationHubs(List<News> newsList, List<Event> eventList, List<Project> projectList, List<Member> memberList, List<OfficeMember> officeMemberList)
        {
            DateToStringConverter dateToStringConverter = new DateToStringConverter();
            MainHubViewModel tempHub = new MainHubViewModel();
            ObservableCollection<MainHubViewModel> tempHubs = new ObservableCollection<MainHubViewModel>();
            
            #region News formater

            tempHub = new MainHubViewModel();

            tempHub.HubName = _res.GetString("NewsPageTitleMain");
            tempHub.NbItems = newsList.Count;
            int cpt = 0;
            foreach (News news in newsList)
            {
                string img;
                if (news.ImageURL == "")
                    img = "/Content/Images/News/default.png";
                else
                    img = news.ImageURL;

                tempHub.Add(new MainItemViewModel()
                {
                    ID = news.ID,
                    Photo = img,
                    Title = news.Title,
                    Subtitle = dateToStringConverter.ConvertDateToString(news.PubDate, news.Schedule, false),
                    IsDescription = false,
                    LabelImage = "/Content/Images/News/label.png",
                    DescriptionVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    ImageOnlyVisibility = Visibility.Collapsed,
                    IsEvent = false,
                    IsNews = true,
                    IsProject = false
                });
            }

            tempHubs.Add(tempHub);
            #endregion

            #region Events formater
            tempHub = new MainHubViewModel();

            tempHub.HubName = _res.GetString("EventsPageTitleMain");
            tempHub.NbItems = eventList.Count;
            cpt = 0;
            foreach (Event events in eventList)
            {
                string img;
                if (events.PictureURI == "")
                    img = "/Content/Images/Events/default.png";
                else
                    img = events.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {
                    ID = events.ID,
                    Photo = img,
                    Title = events.Title,
                    Subtitle = dateToStringConverter.ConvertDateToString(events.Date, events.Schedule, false),
                    LabelImage = "/Content/Images/Events/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,
                    ImageOnlyVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    IsEvent = true,
                    IsNews = false,
                    IsProject = false
                });

                cpt++;
            }

            tempHubs.Add(tempHub);

            #endregion

            #region Projects formater
            tempHub = new MainHubViewModel();

            tempHub.HubName = _res.GetString("ProjectsPageTitleMain");
            tempHub.NbItems = projectList.Count;

            foreach (Project project in projectList)
            {
                string img;
                if (project.PictureURI == "")
                    img = "/Content/Images/Projects/default.png";
                else
                    img = project.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {
                    ID = project.ID,
                    Photo = img,
                    Title = project.Title,
                    Subtitle = project.SubTitle,
                    LabelImage = "/Content/Images/Projects/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    ImageOnlyVisibility = Visibility.Collapsed,
                    IsEvent = false,
                    IsNews = false,
                    IsProject = true
                });
            }

            tempHubs.Add(tempHub);
            #endregion

            #region Members formater
            tempHub = new MainHubViewModel();

            tempHub.HubName = _res.GetString("MembersMainPage");
            tempHub.NbItems = projectList.Count;

            foreach (Member member in memberList)
            {
                string img;
                if (member.PictureURI == "")
                    img = "/Content/Images/Members/default.png";
                else
                    img = member.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {

                    Photo = img,
                    Title = member.FirstName + " " + member.LastName,
                    Subtitle = this._res.GetString(MEMBER_SINCE_KEY) + " " + dateToStringConverter.ConvertDateToString(member.MemberSince, false, false),
                    LabelImage = "/Content/Images/Members/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    ImageOnlyVisibility = Visibility.Collapsed
                });
            }

            tempHubs.Add(tempHub);
            #endregion

            #region OfficeMembers formater
            tempHub = new MainHubViewModel();

            tempHub.HubName = _res.GetString("MembersMainPage");
            tempHub.NbItems = projectList.Count;

            foreach (OfficeMember member in officeMemberList)
            {
                string img;
                if (member.PictureURI == "")
                    img = "/Content/Images/Members/default.png";
                else
                    img = member.PictureURI;

                tempHub.Add(new MainItemViewModel()
                {

                    Photo = img,
                    Title = member.FirstName + " " + member.LastName,
                    Subtitle = member.Title,
                    LabelImage = "/Content/Images/Members/label.png",
                    IsDescription = false,
                    DescriptionVisibility = Visibility.Collapsed,
                    OtherVisibility = Visibility.Visible,
                    ImageOnlyVisibility = Visibility.Collapsed
                });
            }

            tempHubs.Add(tempHub);
            #endregion

            return tempHubs;

        }