Exemple #1
0
        private void EjecutarConsultaActionOnExecute(object sender, SimpleActionExecuteEventArgs e)
        {
            var objectSpace = (XPObjectSpace)Application.CreateObjectSpace();

            var objetoParametros = (IConsultaStoredProcedure)View.CurrentObject;
            var xpClassInfo      =
                XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary.QueryClassInfo(objetoParametros.ClaseResultados);

            var objectsFromSproc = objectSpace.Session.GetObjectsFromSproc(xpClassInfo,
                                                                           objetoParametros.NombreStoredProcedure, objetoParametros.Parametros);
            var collectionSource = new CollectionSource(objectSpace, objetoParametros.ClaseResultados);

            foreach (var item in objectsFromSproc)
            {
                collectionSource.Add(item);
            }

            var view = Application.CreateListView(Application.Model.BOModel[xpClassInfo.FullName].DefaultListView,
                                                  collectionSource, true);

            view.Editor.AllowEdit = false;
            Application.MainWindow.SetView(view);

            e.ShowViewParameters.TargetWindow = TargetWindow.NewWindow;
            e.ShowViewParameters.Context      = TemplateContext.ApplicationWindow;
        }
Exemple #2
0
        async Task LoadMovie(int id)
        {
            Item = await TMDbService.GetDetailedFilmAsync(id);

            Item.poster_path   = "";
            Item.backdrop_path = "";

            PosterSource.Clear();
            foreach (var posterItem in Item.images.posters)
            {
                PosterSource.Add(posterItem);
            }

            BackdropSource.Clear();
            foreach (var backdropItem in Item.images.backdrops)
            {
                BackdropSource.Add(backdropItem);
            }

            ReviewSource.Clear();
            foreach (var reviewItem in Item.reviews.results)
            {
                ReviewSource.Add(reviewItem);
            }

            CollectionSource.Clear();
            if (Item.belongs_to_collection != null && Item.collection_films != null)
            {
                foreach (var collectionItem in Item.collection_films)
                {
                    CollectionSource.Add(collectionItem);
                }
            }

            RecommendationsSource.Clear();
            foreach (var recommendationItem in Item.recommendations.results)
            {
                RecommendationsSource.Add(recommendationItem);
            }

            CastSource.Clear();
            foreach (var castItem in Item.credits.cast)
            {
                CastSource.Add(castItem);
            }

            CrewSource.Clear();
            foreach (var crewItem in Item.credits.crew)
            {
                CrewSource.Add(crewItem);
            }

            LoadCompleted();
        }
Exemple #3
0
        private void RemoveParticipantAction_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            //string participantListId = Application.FindLookupListViewId(typeof(ScheduleParticipant));
            //IObjectSpace objectSpace = Application.CreateObjectSpace();
            //Schedule master = (Schedule)objectSpace.GetObject(View.CurrentObject);
            //CollectionSource cs = new CollectionSource(objectSpace, typeof(ScheduleParticipant));
            //cs.Criteria["ScheduleParticipantFilter"] = new InOperator("Oid", master.ScheduleParticipants);
            //e.View = Application.CreateListView(participantListId, cs, false);

            //IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(ScheduleParticipant));
            //Schedule currentSchedule = (Schedule)objectSpace.GetObject(View.CurrentObject);
            //string participantListId = Application.FindLookupListViewId(typeof(ScheduleParticipant));
            //CollectionSourceBase collectionSource = Application.CreatePropertyCollectionSource(objectSpace, typeof(Schedule), currentSchedule, XafTypesInfo.Instance.FindTypeInfo(typeof(Schedule)).FindMember("ScheduleParticipants"), participantListId);
            //e.View = Application.CreateListView(participantListId, collectionSource, false);


            IObjectSpace     objectSpace       = Application.CreateObjectSpace(typeof(TemporaryScheduleParticipant));
            string           participantListId = Application.FindLookupListViewId(typeof(TemporaryScheduleParticipant));
            CollectionSource collectionSource  = new CollectionSource(objectSpace, typeof(TemporaryScheduleParticipant));
            Schedule         currentSchedule   = (Schedule)View.CurrentObject;

            foreach (ScheduleParticipant detail in currentSchedule.ScheduleParticipants)
            {
                TemporaryScheduleParticipant tempParticipant = objectSpace.CreateObject <TemporaryScheduleParticipant>();
                tempParticipant.Participant = objectSpace.GetObjectByKey <People>(detail.Participant.Oid);
                collectionSource.Add(tempParticipant);
            }


            e.View         = Application.CreateListView(participantListId, collectionSource, false);
            e.View.Caption = "Remove Participant";
            e.Context      = TemplateContext.FindPopupWindow;
            //var listView = Application.CreateListView(ObjectSpace, typeof(ScheduleParticipant), false);
            //if (this.View is ListView)
            //{
            //   foreach (object obj in ((ListView)this.View).CollectionSource.List)
            //   {
            //      listView.CollectionSource.List.Add(obj);
            //   }
            //}
            //if (((Schedule)View.CurrentObject).ScheduleParticipants.Count > 0)
            //{
            //   foreach(object detail in ((Schedule)View.CurrentObject).ScheduleParticipants)
            //   {
            //      listView.CollectionSource.Add(detail);
            //   }
            //}
            //e.View = listView;
            //e.Context = TemplateContext.LookupWindow;
            //e.DialogController.SaveOnAccept = false;
        }
Exemple #4
0
        private void buscarCPAAction_Execute(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            var dir = ((PersonaDireccion)View.CurrentObject).Direccion;
            var loc = dir.Localidad != null ? dir.Localidad.Nombre : dir.LocalidadOtra;

            if (dir.Provincia == null)
            {
                throw new UserFriendlyException("Debe indicar primero la provincia.");
            }

            var prov = dir.Provincia.Codigo;

            IList <CPA.LocalidadResultItem> locs;

            if (prov == "C")
            {
                locs = new List <CPA.LocalidadResultItem>
                {
                    new CPA.LocalidadResultItem
                    {
                        Codigo          = 5001,
                        CodigoProvincia = "C",
                        Nombre          = "Ciudad Autonoma de Buenos Aires"
                    }
                };
            }
            else
            {
                locs = CPA.ObtenerLocalidades(prov, loc);
            }

            var collectionSource = new CollectionSource(ObjectSpace, typeof(CPA.LocalidadResultItem));

            foreach (var loci in locs)
            {
                collectionSource.Add(loci);
            }

            var view = Application.CreateListView(Application.GetListViewId(typeof(CPA.LocalidadResultItem)),
                                                  collectionSource, false);

            view.Editor.AllowEdit = false;
            e.View = view;

            e.DialogController.SaveOnAccept = false;
            e.DialogController.Accepting   += DialogController_Execute;
        }
Exemple #5
0
        private void RemoveCategory_CustomizePopupWindowParams(object sender, CustomizePopupWindowParamsEventArgs e)
        {
            IObjectSpace     objectSpace       = Application.CreateObjectSpace(typeof(TemporaryResourceCategory));
            string           participantListId = Application.FindLookupListViewId(typeof(TemporaryResourceCategory));
            CollectionSource collectionSource  = new CollectionSource(objectSpace, typeof(TemporaryResourceCategory));
            ResourceLibrary  currentSchedule   = (ResourceLibrary)View.CurrentObject;

            foreach (ResourceCategory detail in currentSchedule.ResourceCategories)
            {
                TemporaryResourceCategory tempCategory = objectSpace.CreateObject <TemporaryResourceCategory>();
                tempCategory.Category = objectSpace.GetObjectByKey <ResourceCategory>(detail.Oid);
                collectionSource.Add(tempCategory);
            }


            e.View         = Application.CreateListView(participantListId, collectionSource, false);
            e.View.Caption = "Remove Category";
            e.Context      = TemplateContext.FindPopupWindow;
        }
Exemple #6
0
        private void DialogController_Execute(object sender, DialogControllerAcceptingEventArgs e)
        {
            var dir = ((PersonaDireccion)View.CurrentObject).Direccion;

            if (e.AcceptActionArgs.SelectedObjects.Count < 1)
            {
                return;
            }
            var selectedLoc = (CPA.LocalidadResultItem)e.AcceptActionArgs.SelectedObjects[0];

            var cps = CPA.ObtenerCPA(selectedLoc.Codigo, dir.Calle, dir.Numero);

            var collectionSource = new CollectionSource(ObjectSpace, typeof(CPA.CPAResultItem));

            foreach (var cp in cps)
            {
                collectionSource.Add(cp);
            }

            var view = Application.CreateListView(Application.GetListViewId(typeof(CPA.CPAResultItem)), collectionSource,
                                                  false);

            view.Editor.AllowEdit = false;
            e.AcceptActionArgs.ShowViewParameters.CreatedView  = view;
            e.AcceptActionArgs.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
            e.AcceptActionArgs.ShowViewParameters.Context      = TemplateContext.PopupWindow;
            var dc = Application.CreateController <DialogController>();

            e.AcceptActionArgs.ShowViewParameters.Controllers.Add(dc);

            dc.Tag          = selectedLoc;
            dc.SaveOnAccept = false;
            dc.Accepting   += CPAResultItem_DialogController_Accepting;
            //Truco para forzar la apertura de la view; por lo visto es la unica forma de encadenar dos Popup views
            Application.ShowViewStrategy.ShowView(e.AcceptActionArgs.ShowViewParameters,
                                                  new ShowViewSource(Frame, e.AcceptActionArgs.Action));
        }