Esempio n. 1
0
        private void btnClearCache_Click(object sender, EventArgs e)
        {
            int successCount = 0;

            this.Cursor = Cursors.WaitCursor;
            foreach (ListViewItem item in lvwDataSources.CheckedItems)
            {
                Data.ExternalSystem selectedDataSource = item.Tag as Data.ExternalSystem;

                try
                {
                    ServiceCommunicator.ClearDataSource(selectedDataSource.ExternalSystemId, selectedDataSource.ExternalSystemName);
                    successCount++;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            this.Cursor = Cursors.Default;

            if (successCount == lvwDataSources.CheckedItems.Count)
            {
                MessageBox.Show("Success!", "Cache Cleared", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if ((successCount == 0) &&
                     (lvwDataSources.CheckedItems.Count > 0))
            {
                MessageBox.Show("All Failed!", "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("Partially Failed!", "Partially Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        void CheckServiceStatus(string status = null)
        {
            this.Cursor = Cursors.WaitCursor;
            if (status == null)
            {
                SetStatusText("Checking service status...");
                status = ServiceCommunicator.GetPullersStatus();
            }

            toolStripButton2.Image       = ServiceRunningImage;
            toolStripButton2.ToolTipText = "Service is running";
            SetStatusText("Ready");

            if (string.IsNullOrEmpty(status))
            {
                if (EyediaCoreConfigurationSection.CurrentConfig.HostingEnvironment == EyediaCoreConfigurationSection.HostingEnvironments.WindowsService)
                {
                    toolStripButton2.ToolTipText = "The service is not running. Click here to refresh once service is up and running!";
                    toolStripButton2.Image       = null;
                }
                else if (EyediaCoreConfigurationSection.CurrentConfig.HostingEnvironment == EyediaCoreConfigurationSection.HostingEnvironments.WindowsService)
                {
                    toolStripButton2.ToolTipText = "The engine is not active. Make sure ASP.Net/IIS is configured properly.Double click here to refresh once web app is up and running!";
                }
            }

            this.Cursor = Cursors.Default;
        }
Esempio n. 3
0
        public void DisassociateAttributeFromDataSource(ListViewControl sreListView1, bool isSystemDataSource = false)
        {
            int     dataSourceId = isSystemDataSource ? (int)SelectedDataSource.SystemDataSourceId : SelectedDataSource.Id;
            bool    saved        = false;
            Manager manager      = new Manager();

            SreDataSourceProperty.KeepVersion(dataSourceId);

            if (sreListView1.ListView.SelectedItems.Count > 0)
            {
                if ((sreListView1.ListView.SelectedItems.Count == 1) &&
                    (sreListView1.ListView.SelectedItems[0].Text != "IsValid"))
                {
                    if (MessageBox.Show(string.Format("You are about to disassociate {0} from {1}. Are you sure?", sreListView1.ListView.SelectedItems[0].Text, SelectedDataSource.Name),
                                        "Disassociate Attribute", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
                    {
                        return;
                    }

                    if (manager.DisassociateAttributeFromDataSource(dataSourceId, (sreListView1.ListView.SelectedItems[0].Tag as IdpeAttribute).AttributeId) == true)
                    {
                        sreListView1.ListView.Items.Remove(sreListView1.ListView.SelectedItems[0]);
                        saved = true;
                    }
                }
                else
                {
                    foreach (ListViewItem selectedItem in sreListView1.ListView.SelectedItems)
                    {
                        if (selectedItem.Text != "IsValid")
                        {
                            if (manager.DisassociateAttributeFromDataSource(dataSourceId, (selectedItem.Tag as IdpeAttribute).AttributeId) == true)
                            {
                                sreListView1.ListView.Items.Remove(sreListView1.ListView.SelectedItems[0]);
                            }
                            saved = true;
                        }
                    }
                }
            }

            if (saved)
            {
                SaveAssociations(sreListView1.ListView, isSystemDataSource, false);
            }

            if (ServiceCommunicator.ClearDataSource(SelectedDataSource.Id, string.Empty))
            {
                SetToolStripStatusLabel("Ready");
            }
            else
            {
                SetToolStripStatusLabel("Failed to clear cache", true);
            }
        }
Esempio n. 4
0
 private void tsbClearCache_Click(object sender, EventArgs e)
 {
     MainWindow.SetToolStripStatusLabel("Please wait...Clearing cache...");
     Application.DoEvents();
     if (ServiceCommunicator.ClearDataSource(_SreDataSource.Id, string.Empty))
     {
         MainWindow.SetToolStripStatusLabel("Ready");
     }
     else
     {
         MainWindow.SetToolStripStatusLabel("Failed to clear cache", true);
     }
     this.Cursor = Cursors.Default;
 }
Esempio n. 5
0
        void OnAttributeRepositioned(object sender, EventArgs e)
        {
            ListViewControl listView = sender as ListViewControl;

            if (listView.Parent is DockPanelDataSourceAttributes)
            {
                SaveAssociations(m_dm_Attributes.sreListView1.ListView);
            }
            else if (listView.Parent is DockPanelDataSourceSystemAttributes)
            {
                SaveAssociations(m_dm_SystemAttributes.sreListView1.ListView, true);
            }

            if (ServiceCommunicator.ClearDataSource(SelectedDataSource.Id, string.Empty))
            {
                SetToolStripStatusLabel("Ready");
            }
            else
            {
                SetToolStripStatusLabel("Failed to clear cache", true);
            }
        }
Esempio n. 6
0
        void OnDataSourceChanged(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            dockPanel.SuspendLayout(true);
            ListViewControl sreListView = sender as ListViewControl;

            if (sreListView != null)
            {
                if (sreListView.ListView.SelectedItems.Count > 0)
                {
                    //if (((IdpeDataSource)sreListView.ListView.SelectedItems[0].Tag).Id == 100)
                    //{
                    //    m_dm_GlobalAttributes.btnAssociateBoth.Enabled = false;
                    //    m_dm_GlobalAttributes.btnAssociateAttributeDataSource.Enabled = false;
                    //    m_dm_GlobalAttributes.btnAssociateAttributeSystemDataSource.Enabled = false;
                    //    this.Cursor = Cursors.Default;
                    //    return;
                    //}
                    //else
                    //{
                    //    m_dm_GlobalAttributes.btnAssociateBoth.Enabled = true;
                    //    m_dm_GlobalAttributes.btnAssociateAttributeDataSource.Enabled = true;
                    //    m_dm_GlobalAttributes.btnAssociateAttributeSystemDataSource.Enabled = true;
                    //}

                    if ((m_dm_Property.propertyGrid.SelectedObject != null) &&
                        (((SrePropertyGrid)m_dm_Property.propertyGrid.SelectedObject).HasChanged))
                    {
                        this.Cursor = Cursors.WaitCursor;
                        toolStripStatusLabel1.Text = "Please wait...Saving properties...";
                        Application.DoEvents();
                        ((SrePropertyGrid)m_dm_Property.propertyGrid.SelectedObject).Save();

                        toolStripStatusLabel1.Text = "Please wait...Clearing cache...";
                        Application.DoEvents();
                        if (ServiceCommunicator.ClearDataSource(SelectedDataSource.Id, string.Empty))
                        {
                            SetToolStripStatusLabel("Ready");
                        }
                        else
                        {
                            SetToolStripStatusLabel("Failed to clear cache", true);
                        }

                        toolStripStatusLabel1.Text = "Please wait...Refresing...";
                        Application.DoEvents();
                        RefreshData();
                        if (MainWindowShown)
                        {
                            SetToolStripStatusLabel("Ready");
                        }
                        this.Cursor = Cursors.Default;
                    }

                    if (sreListView.ListView.SelectedItems.Count > 0)
                    {
                        toolStripStatusLabel1.Text = "Please wait...Refresing...";
                        Application.DoEvents();
                        if ((sreListView.DefaultItemId > 0) && (!MainWindowShown))
                        {
                            SelectedDataSource = sreListView.ListView.Items.Cast <ListViewItem>().Select(x => x.Tag).ToList().Cast <IdpeDataSource>().Where(ds => ds.Id == sreListView.DefaultItemId).SingleOrDefault();
                            if (sreListView.DefaultItem != null)
                            {
                                sreListView.DefaultItem.EnsureVisible();
                            }

                            if (SelectedDataSource == null)
                            {
                                SelectedDataSource = sreListView.ListView.Items[0].Tag as IdpeDataSource;
                            }
                        }
                        else
                        {
                            SelectedDataSource = sreListView.ListView.SelectedItems[0].Tag as IdpeDataSource;
                        }

                        m_dm_DataSources.SelectedDataSource      = SelectedDataSource;
                        m_dm_Attributes.SelectedDataSource       = SelectedDataSource;
                        m_dm_SystemAttributes.SelectedDataSource = SelectedDataSource;
                        m_dm_GlobalAttributes.SelectedDataSource = SelectedDataSource;
                        if (MainWindowShown)
                        {
                            SetToolStripStatusLabel("Ready");
                        }
                        Application.DoEvents();
                    }
                    m_dm_Attributes.DataSourceId             = SelectedDataSource.Id;
                    m_dm_SystemAttributes.SystemDataSourceId = (int)SelectedDataSource.SystemDataSourceId;
                    m_dm_Property.DataSource = SelectedDataSource;
                    SetToolStripStatusLabel("Ready");
                }
            }
            dockPanel.ResumeLayout(true, true);
            this.Cursor = Cursors.Default;
            sreListView.ListView.Focus();
        }