Ejemplo n.º 1
0
 private void InitializeViews()
 {
     BasesViewModel = new BasesViewModel(db);
     BasesView      = new BasesView {
         DataContext = BasesViewModel
     };
     PlatformViewModel = new PlatformViewModel(db);
     PlatformView      = new PlatformView {
         DataContext = PlatformViewModel
     };
     ActionsViewModel = new ActionsViewModel(db);
     ActionsView      = new ActionsView {
         DataContext = ActionsViewModel
     };
     DistributionViewModel = new DistributionViewModel(db);
     DistributionView      = new DistributionView {
         DataContext = DistributionViewModel
     };
     HomeViewModel = new HomeViewModel(db);
     HomeView      = new HomeView {
         DataContext = HomeViewModel
     };
     TelegramViewModel = new TelegramViewModel(db);
     TelegramView      = new TelegramView {
         DataContext = TelegramViewModel
     };
 }
        public static string GetActionsViewItem(RestCommand command, int actionID)
        {
            ActionsViewItem actionsViewItem = ActionsView.GetActionsViewItem(command.LoginUser, actionID);

            if (actionsViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(actionsViewItem.GetXml("ActionsViewItem", true));
        }
Ejemplo n.º 3
0
        public static string GetCustomerAction(RestCommand command, int actionID)
        {
            ActionsViewItem action = ActionsView.GetActionsViewItem(command.LoginUser, actionID);
            TicketsViewItem ticket = action.GetTicket();

            if (ticket.OrganizationID != command.Organization.ParentID || !ticket.GetIsCustomer(command.Organization.OrganizationID))
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            return(action.GetXml("Action", true));
        }
Ejemplo n.º 4
0
        public static string GetAction(RestCommand command, int actionID)
        {
            ActionsViewItem action = ActionsView.GetActionsViewItem(command.LoginUser, actionID);

            if (action.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            action.Description = RemoveInvalidXmlChars(action.Description);

            return(action.GetXml("Action", true));
        }
Ejemplo n.º 5
0
        public static string GetCustomerActions(RestCommand command, int ticketID)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItemByIdOrNumberForCustomer(command.LoginUser, (int)command.Organization.ParentID, ticketID);

            if (ticket.OrganizationID != command.Organization.ParentID || !ticket.GetIsCustomer(command.Organization.OrganizationID))
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            ActionsView actions = new ActionsView(command.LoginUser);

            actions.LoadByTicketID(ticket.TicketID);

            return(actions.GetXml("Actions", "Action", true, command.Filters));
        }
        public static string GetActionsView(RestCommand command)
        {
            ActionsView actionsView = new ActionsView(command.LoginUser);

            actionsView.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(actionsView.GetXml("ActionsView", "ActionsViewItem", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
Ejemplo n.º 7
0
        public static string GetActions(RestCommand command, int ticketIDOrNumber, int?limitNumber = null)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItemByIdOrNumber(command.LoginUser, ticketIDOrNumber);

            if (ticket.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            ActionsView actions = new ActionsView(command.LoginUser);

            actions.LoadByTicketID(ticket.TicketID, limitNumber);

            actions.Select(p => { p.Description = RemoveInvalidXmlChars(p.Description); return(p); }).ToList();

            return(actions.GetXml("Actions", "Action", true, command.Filters));
        }
Ejemplo n.º 8
0
        public static string CreateAction(RestCommand command, int ticketIDOrNumber)
        {
            TicketsViewItem ticket = TicketsView.GetTicketsViewItemByIdOrNumber(command.LoginUser, ticketIDOrNumber);

            if (ticket.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            Actions actions = new Actions(command.LoginUser);

            TeamSupport.Data.Action action = actions.AddNewAction();
            action.TicketID = ticket.TicketID;
            action.ReadFromXml(command.Data, true);
            action.Collection.Save();
            action.UpdateCustomFieldsFromXml(command.Data);
            return(ActionsView.GetActionsViewItem(command.LoginUser, action.ActionID).GetXml("Action", true));
        }
Ejemplo n.º 9
0
        public static string UpdateAction(RestCommand command, int actionID)
        {
            TeamSupport.Data.Action action = Actions.GetAction(command.LoginUser, actionID);
            if (action == null)
            {
                throw new RestException(HttpStatusCode.BadRequest);
            }
            Ticket ticket = Tickets.GetTicket(command.LoginUser, action.TicketID);

            if (ticket.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            action.ReadFromXml(command.Data, false);
            action.Collection.Save();
            action.UpdateCustomFieldsFromXml(command.Data);
            return(ActionsView.GetActionsViewItem(command.LoginUser, action.ActionID).GetXml("Action", true));
        }
    private void WriteActions(TicketGridViewItem ticket)
    {
        ActionsView actions = new ActionsView(UserSession.LoginUser);

        actions.LoadByTicketID(ticket.TicketID);

        StringBuilder builder = new StringBuilder();

        foreach (ActionsViewItem action in actions)
        {
            string actionTitle = action.Name;
            if (action.Name != action.ActionType)
            {
                actionTitle = action.ActionType + ": " + actionTitle;
            }

            builder.Append(string.Format("<div class=\"actionHeaderDiv ui-corner-all\">{0}</div>", actionTitle));
            builder.Append(string.Format("<div class=\"actionBodyDiv\">{0}</div>", action.Description));
            builder.Append(string.Format("<div class=\"actionFooterDiv\">- {0} {1}</div>",
                                         action.CreatorName, action.DateCreated.ToString("g", UserSession.LoginUser.CultureInfo)));
        }

        litActions.Text = builder.ToString();
    }
Ejemplo n.º 11
0
        public EnvironmentComparerPluginControl(IThemeProvider themeProvider)
        {
            if (themeProvider == null)
            {
                throw new ArgumentNullException(nameof(themeProvider));
            }


            InitializeComponent();

            this.messenger = new Messenger(this);

            this.tEnv1Name.Text      = "1. Connect to environment 1";
            this.tConnectToEnv2.Text = ConnectToEnvironment2String;


            this.outputView = new OutputView(themeProvider, messenger);
            this.outputView.Show(this.dockPanel, DockState.DockBottomAutoHide);

            this.viewModel = new EnvironmentComparerViewModel(this.messenger);
            var scheduler = new AsyncJobScheduler(this, viewModel);

            this.resultTreeView = new ResultTreeView(themeProvider, scheduler, this.messenger, this.outputView);
            this.resultTreeView.Show(this.dockPanel, DockState.DockLeft);

            this.configuratorView = new ConfiguratorView(themeProvider, scheduler, this.messenger, this.outputView);
            this.configuratorView.Show(this.dockPanel, DockState.DockLeft);

            this.resultGridView = new ResultGridView(themeProvider, this.messenger, this.outputView);
            this.resultGridView.Show(this.dockPanel, DockState.Document);

            this.resultRecordView = new ResultRecordView(themeProvider, this.messenger);
            this.resultRecordView.Show(this.dockPanel, DockState.Document);

            this.actionsView = new ActionsView(themeProvider, scheduler, this.messenger, this.outputView);
            this.actionsView.Show(this.dockPanel, DockState.Document);

            var helpContentIndexProvider = new HelpContentIndexProvider();
            var helpContentIndex         = helpContentIndexProvider.GetIndex();
            var helpRepository           = new HelpRepository(helpContentIndex, GetType().Assembly);
            var helpView = new HelpView(this.messenger, this.outputView, helpRepository, Topics.Home);

            helpView.Show(this.dockPanel, DockState.DockRight);
            helpView.DockState = DockState.DockRightAutoHide;
            // trick used because the DockState.AutoHide doesn't works well with browser control: the WebBrowser control "Dispose" method throws an exception if the form has not been loaded

            this.resultGridView.Show();
            this.configuratorView.Show();

            this.tEquals.Bind(_ => _.Visible, this.viewModel, _ => _.AreEqual);


            this.messenger.Register <HighlightResultRecord>(m =>
            {
                this.resultRecordView.Show();
            });
            this.messenger.Register <LoadEntitiesRequest>(m =>
            {
                ExecuteMethod(LoadEntities);
            });

            this.messenger.Register <StatusBarMessageEventArgs>(m =>
            {
                this.SendMessageToStatusBar?.Invoke(this, m);
            });
        }