Ejemplo 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);
            }
        }
Ejemplo n.º 2
0
        public BindingList <ExternalSystem> GetAllExternalSystems(bool?onlySystemType)
        {
            List <ExternalSystem> returnList = new List <ExternalSystem>();

            string commandText = string.Empty;

            if (onlySystemType == null) //get all
            {
                commandText = "select [Id],[Name],[IsSystem] from IdpeDataSource order by [Id], [IsSystem] desc";
            }
            else
            {
                commandText = "select [Id],[Name],[IsSystem] from IdpeDataSource where [IsSystem] = " + (onlySystemType == true ? "1" : "0") + " order by [Id], [IsSystem] desc";
            }

            DataTable table = CoreDatabaseObjects.Instance.ExecuteCommand(commandText);

            if (table == null)
            {
                return(new BindingList <ExternalSystem>(returnList));
            }

            foreach (DataRow row in table.Rows)
            {
                ExternalSystem es = new ExternalSystem();
                es.ExternalSystemId   = (int)row["Id"].ToString().ParseInt();
                es.ExternalSystemName = row["Name"] != DBNull.Value ? row["Name"].ToString() : null;
                es.IsSystemType       = (bool)row["IsSystem"].ToString().ParseBool();
                es.IsHavingVersion    = IsHavingVersion(VersionObjectTypes.DataSource, es.ExternalSystemId);

                returnList.Add(es);
            }
            return(new BindingList <ExternalSystem>(returnList));
        }