Esempio n. 1
0
        // Create and populate a Datatable
        // Return the ViewGuide view and pass it a GuideViewModel
        public ActionResult ViewGuide(string Type)
        {
            DataTable      table = GetTable(Type);
            GuideViewModel model = new GuideViewModel(table, Type);

            return(View(model));
        }
Esempio n. 2
0
        public GuideViewModel GetResourceAuthorities(int resourceId)
        {
            var gvm = new GuideViewModel();

            var agentSql = Sql.Builder
                           .Select("linked_agents_rlshp.agent_person_id, linked_agents_rlshp.agent_family_id, linked_agents_rlshp.agent_corporate_entity_id, " +
                                   "linked_agents_rlshp.role_id, linked_agents_rlshp.relator_id, name_person.sort_name AS person_name, " +
                                   "name_family.sort_name AS family_name, name_corporate_entity.sort_name AS corp_name")
                           .From("linked_agents_rlshp")
                           .LeftJoin("agent_person").On("agent_person.id = linked_agents_rlshp.agent_person_id")
                           .LeftJoin("name_person").On("name_person.agent_person_id = linked_agents_rlshp.agent_person_id")
                           .LeftJoin("agent_family").On("agent_family.id = linked_agents_rlshp.agent_family_id")
                           .LeftJoin("name_family").On("name_family.agent_family_id = linked_agents_rlshp.agent_family_id")
                           .LeftJoin("agent_corporate_entity").On("agent_corporate_entity.id = linked_agents_rlshp.agent_corporate_entity_id")
                           .LeftJoin("name_corporate_entity").On("name_corporate_entity.agent_corporate_entity_id = linked_agents_rlshp.agent_corporate_entity_id")
                           .Where("resource_id = @0", resourceId)
                           .OrderBy("person_name, family_name, corp_name");

            var subjectSql = Sql.Builder
                             .Select("subject.id, subject.title AS subject, (select value from archivesspace.enumeration_value where id = (select term_type_id from archivesspace.term WHERE id = (select term_id from archivesspace.subject_term where subject_id = subject.id))) AS type")
                             .From("subject_rlshp")
                             .LeftJoin("subject").On("subject.id = subject_rlshp.subject_id")
                             .Where("resource_id = @0", resourceId);

            using (var db = Connection)
            {
                gvm.AsAgents   = db.Fetch <AgentGroup>(agentSql);
                gvm.AsSubjects = db.Fetch <SubjectGroup>(subjectSql);
            }

            return(gvm);
        }
Esempio n. 3
0
 private void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Dictionary <int, string> guideExcursions = new Dictionary <int, string>();
         foreach (var exc in ListBoxExcursion.SelectedItems)
         {
             var excursion = (ExcursionViewModel)exc;
             guideExcursions.Add(excursion.ID, excursion.Name);
         }
         GuideViewModel guide = (GuideViewModel)ComboBoxChoosenGuide.SelectedItem;
         guidelogic.CreateOrUpdate(new GuideBindingModel
         {
             ID                 = guide.ID,
             Name               = guide.Name,
             Surname            = guide.Surname,
             WorkPlace          = guide.WorkPlace,
             PhoneNumber        = guide.PhoneNumber,
             MainLanguage       = guide.MainLanguage,
             AdditionalLanguage = guide.AdditionalLanguage,
             OperatorID         = App.Operator.ID,
             GuideExcursions    = guideExcursions
         });
         MessageBox.Show("Привязка прошла успешно", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Information);
         DialogResult = true;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         logger.Warn("Ошибка при попытке привязки гидов к экскурсии");
     }
 }
Esempio n. 4
0
        public virtual ActionResult Index()
        {
            var date     = DateTime.Today;
            var events   = _eventService.GetFullGuide(date);
            var channels = _channelService.GetChannels();
            var model    = new GuideViewModel(events, date, channels);

            return(View(model));
        }
Esempio n. 5
0
        public virtual PartialViewResult EpgDay(string date)
        {
            var dateob = date.HasValue() ? date.FromISO8601String() : DateTime.Today;

            var events   = _eventService.GetFullGuide(dateob);
            var channels = _channelService.GetChannels();
            var model    = new GuideViewModel(events, dateob.Value, channels);

            return(PartialView(MVC.Guide.Views._ChannelListing, model));
        }
        private static GuideViewModel MapUmbracoContentToViewModel(IPublishedContent content)
        {
            var model = new GuideViewModel()
            {
                Steps = new List <GuideStepViewModel>(content.Children <IPublishedContent>()
                                                      .Where(child => child.ContentType.Alias == "GuideStep")
                                                      .Select(MapUmbracoContentToGuideStepViewModel))
            };

            return(model);
        }
Esempio n. 7
0
        private void LoadData()
        {
            ComboBoxHalts.ItemsSource = Hlogic.Read(new HaltBindingModel {
                OperatorID = App.Operator.ID
            });
            ComboBoxHalts.SelectedItem = null;
            var tours = logic.Read(new TourBindingModel {
                OperatorID = App.Operator.ID
            });

            foreach (var tour in tours)
            {
                if (tour.ID == id)
                {
                    this.tour = tour;
                }
            }
            var listbindmodels = Guidelogic.Read(new GuideBindingModel {
                OperatorID = App.Operator.ID
            });

            foreach (var guide in listbindmodels)
            {
                ListBoxAvailable.Items.Add(guide);
            }
            if (tour != null)
            {
                ListBoxAvailable.Items.Clear();
                List <int> array = new List <int>();
                var        listSelectedGuides = tour.TourGuides.ToList();
                foreach (var guide in listSelectedGuides)
                {
                    GuideViewModel current = Guidelogic.Read(new GuideBindingModel
                    {
                        ID = guide.Key
                    })[0];
                    ListBoxSelected.Items.Add(current);
                    array.Add(current.ID);
                }
                foreach (var guide in listbindmodels)
                {
                    if (!array.Contains(guide.ID))
                    {
                        ListBoxAvailable.Items.Add(guide);
                    }
                }
                NameTextBox.Text            = tour.Name;
                CountryTextBox.Text         = tour.Country;
                PriceTextBox.Text           = tour.Price.ToString();
                ComboBoxHalts.SelectedValue = tour.HaltID;
            }
        }
Esempio n. 8
0
        public IActionResult ViewGuide([FromQuery] int guideId)
        {
            IFixitApi ifa = new IFixitApi();

            string      newSearch = HttpUtility.UrlEncode(guideId.ToString());
            IFixitGuide data      = ifa.MakeGuideCall("guides/" + guideId + "?pretty");

            GuideViewModel ifvm = new GuideViewModel();

            ifvm.Guide = data;

            return(View("ViewGuide", ifvm));
        }
Esempio n. 9
0
        public ActionResult SubjectView(int id)
        {
            ViewBag.ArchivesSpaceUrl = ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id;
            var gvm       = new GuideViewModel();
            var resources = AsRepo.GetArchivesSpaceResources();

            gvm.Name    = SearchNameByAsUri(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id);
            gvm.Subject = SearchSubjectByAsUri(ConfigurationManager.AppSettings["ArchivesSpaceUrl"] + id);

            var match = resources.FirstOrDefault(x => x.id == id);

            ViewBag.Guide = match.title + $" ({match.ead_id})";

            return(View(gvm));
        }
Esempio n. 10
0
 public ActionResult Create(GuideViewModel guideView)
 {
     if (ModelState.IsValid)
     {
         var guide = new Guide
         {
             GuideId   = guideView.GuideId,
             GuideName = guideView.GuideName,
             HeroOptId = guideView.HeroOptId,
         };
         foreach (var item in guideView.ItemId)
         {
             guide.ItemG.Add(db.Items.FirstOrDefault(x => x.ItemId == item));
         }
         db.Guides.Add(guide);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.HeroOptId = new SelectList(db.HeroOpts, "HeroOptId", "Name", guideView.HeroOptId);
     return(View(guideView));
 }
Esempio n. 11
0
        // GET: Guide
        public ActionResult Index1(int id = 0)
        {
            id = id == 0 ? 1 : id;

            var cats = _guideService.Categories.Select(s => new Category
            {
                Id           = s.Id,
                Title        = s.Title,
                SubTitle     = s.SubTitle,
                CreationDate = s.CreationDate,
                RecordState  = s.RecordState
            });

            var articles = _guideService.ArticlesByCategory(id);

            var model = new GuideViewModel
            {
                Categories       = cats,
                ActiveCategoryId = id,
                Articles         = articles
            };

            return(View(model));
        }
Esempio n. 12
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            Debug.WriteLine("A Guide has been navigated to. We are going to make API calls and do SCIENCE");
            this.guideID = this.NavigationContext.QueryString["GuideID"];
            Debug.WriteLine("\tgot guide id = " + guideID);

            if (tapped != null)
                tapped.Foreground = App.Current.Resources["PhoneForegroundBrush"] as Brush;

            //if the VM is already populated, don't reload it
            if (vm != null)
                return;

            int numCols = -1;
            string key = guideID;
            //if online, do an api call. The callback will be fired to populate the view
            if (DeviceNetworkInformation.IsNetworkAvailable && !this.State.ContainsKey(key))
            {
                Debug.WriteLine("online. Querying for new guide content");

                vm = new GuideViewModel(SourceGuide);
                this.DataContext = vm;

                new JSONInterface2().populateGuideView(this.guideID, insertGuideIntoDB);
            }
            //if not online, populate view from DB
            else
            {
                Debug.WriteLine("offline. Using DB for guide content");
                using (iFixitDataContext db = new iFixitDataContext(App.DBConnectionString))
                {
                    //get the guide, if it already exists
                    //SourceGuide = db.GuidesTable.SingleOrDefault(g => g.GuideID == this.guideID);
                    SourceGuide = DBHelpers.GetCompleteGuide(this.guideID, db);
                    vm = new GuideViewModel(SourceGuide);

                    //force view model to update
                    //vm.UpdateContentFromGuide(SourceGuide);
                    this.DataContext = vm;

                    //hide the loading bar
                    LoadingBarInfo.Visibility = System.Windows.Visibility.Collapsed;
                }
            }

            if (SourceGuide != null)
            {
                numCols = SourceGuide.Steps.Count + 1;
            }
            // if there is a saved index, re-navigate to it
            if (key != null && this.State.ContainsKey(key))
            {
                int selectedTabIndex = (int)this.State[key];
                if (0 <= selectedTabIndex && selectedTabIndex < numCols)
                {
                    GuidePivot.SelectedIndex = selectedTabIndex;
                }
            }
        }