示例#1
0
        public ActionResult DesktopGroupsDetails(string name)
        {
            using (log4net.NDC.Push(Guid.NewGuid().ToString()))
            {
                logger.Debug("Details for DesktopGroup " + name);
                var catInfo  = Catalog.GetCatalogAndUserList(name);
                var machines = Machine.GetMachines(name).ToArray();
                foreach (var machine in machines)
                {
                    if (machine.AssociatedUserNames.Length == 0)
                    {
                        logger.Debug("Machine " + machine.MachineName + " has no associated users");
                        machine.AssociatedUserNames = new string[] { "None at the moment" };
                    }
                    else if (machine.AssociatedUserNames.Length > 1)
                    {
                        logger.Info("Machine " + machine.MachineName + " has no " + machine.AssociatedUserNames.Length + " users");
                    }
                }
                var catDetailsViewModel = new CatalogDetailsViewModel()
                {
                    CatalogInfo = catInfo[0], Machines = machines
                };

                return(View(catDetailsViewModel));
            }
        }
        public async Task <ActionResult> Delete(Guid id, CatalogDetailsViewModel request)
        {
            if (!ModelState.IsValid)
            {
                Alert("Bad Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
            if (id == null)
            {
                Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
            try
            {
                var result = await _catalogService.Delete(id);

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View());
                }
                Alert($"Catalog Deleted Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                Alert($"Error Occurred While processing the request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
        }
        // GET: Catalogs/Delete/5
        public async Task <ActionResult> Delete(Guid id)
        {
            var catalog = new CatalogDetailsViewModel();

            try
            {
                var result = await _catalogService.FindById(id);

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View(catalog));
                }
                catalog.Code            = result.Data.Code;
                catalog.Id              = result.Data.Id;
                catalog.Name            = result.Data.Name;
                catalog.EffectiveDate   = result.Data.EffectiveDate;
                catalog.EndDate         = result.Data.EndDate;
                catalog.Published       = result.Data.Published ? "Yes" : "No";
                catalog.Description     = result.Data.Description;
                catalog.DateCreated     = result.Data.CreatedAt;
                catalog.DateLastUpdated = result.Data.LastUpdated;
                catalog.Entity          = result.Data.EntityId.ToString();
                return(View(catalog));
            }
            catch (Exception ex)
            {
                Alert($"Error! {ex.Message}", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View(catalog));
            }
        }
        protected override void OnRemovedFromJournal(System.Windows.Navigation.JournalEntryRemovedEventArgs e)
        {
            model.Pages.Clear();
            model = null;
            slideView.ManipulationCompleted -= slideView_ManipulationCompleted;
            slideView.ItemTemplate           = null; // lsStuff is a RadDataBoundListBox
            slideView = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
示例#5
0
        public async Task OnGet(CatalogDetailsViewModel catalogModel, int?id)
        {
            var result = await _mediator.Send(new GetCatalogDetailsQuery()
            {
                Id = id
            });

            if (result.Succeeded)
            {
                CatalogModel = result.Data;
            }
            else
            {
                CatalogModel = new CatalogDetailsViewModel();
            }
        }
 private void LoadCatalogInfo(string id, string pageCount)
 {
     //this.slideView.TransitionMode = SlideViewTransitionMode.Flip;
     model            = new CatalogDetailsViewModel(id, pageCount);
     this.DataContext = model;
 }