Exemplo n.º 1
0
        public void PopulateAliases()
        {
            ApplicationsDAO lwDataAccess      = new ApplicationsDAO();
            DataTable       applicationsTable = lwDataAccess.GetAliasedApplications();

            LoadFromTable(applicationsTable);
        }
Exemplo n.º 2
0
        private List <int> GetSelectedApplications()
        {
            List <int> appIdsToDelete = new List <int>();

            if (applicationsTree.SelectedNodes[0].Tag.ToString() == "PUBLISHER")
            {
                ApplicationsDAO lApplicationsDAO = new ApplicationsDAO();
                foreach (UltraTreeNode node in applicationsTree.SelectedNodes)
                {
                    DataTable dt = lApplicationsDAO.GetApplicationIdsByPublisherName(node.Text);

                    foreach (DataRow row in dt.Rows)
                    {
                        appIdsToDelete.Add((int)row[0]);
                    }
                }
            }
            else
            {
                foreach (UltraTreeNode node in applicationsTree.SelectedNodes)
                {
                    InstalledApplication installedApplication = node.Tag as InstalledApplication;
                    if (installedApplication != null)
                    {
                        appIdsToDelete.Add(installedApplication.ApplicationID);
                    }
                }
            }
            return(appIdsToDelete);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called as we click the OK button - save the definition back to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnOK_Click(object sender, EventArgs e)
        {
            if (_installedApplication.Publisher != tbPublisher.Text)
            {
                string          oldPublisherName = _installedApplication.Publisher;
                ApplicationsDAO lwDataAccess     = new ApplicationsDAO();
                lwDataAccess.ApplicationUpdatePublisher(_installedApplication.ApplicationID, tbPublisher.Text);
                _installedApplication.Publisher = tbPublisher.Text;

                AuditTrailEntry ate = new AuditTrailEntry();
                ate.Date      = DateTime.Now;
                ate.Class     = AuditTrailEntry.CLASS.application_changes;
                ate.Type      = AuditTrailEntry.TYPE.changed;
                ate.Key       = _installedApplication.Name + "|Publisher";
                ate.AssetID   = 0;
                ate.AssetName = "";
                ate.OldValue  = oldPublisherName;
                ate.NewValue  = tbPublisher.Text;
                ate.Username  = System.Environment.UserName;
                new AuditTrailDAO().AuditTrailAdd(ate);
            }

            // Save any changes made to the user defined data field values
            SaveUserDefinedData();
        }
        /// <summary>
        /// Display the data for this tab where we have selected an asset or child node thereof
        /// </summary>
        /// <param name="displayedNode"></param>
        protected void DisplayForAsset(UltraTreeNode displayedNode)
        {
            // We are displaying ALL publishers and ALL applications for this asset - add in columns for
            // Application Object, Publisher, Name, Version, Serial Number and CD Key
            DataColumn column1 = new DataColumn("ApplicationObject", typeof(object));
            DataColumn column2 = new DataColumn("Publisher", typeof(string));
            DataColumn column3 = new DataColumn("Name", typeof(string));
            DataColumn column4 = new DataColumn("Version", typeof(string));
            DataColumn column5 = new DataColumn("Serial Number", typeof(string));
            DataColumn column6 = new DataColumn("CD Key", typeof(string));

            // Add these columns to the DataSet
            applicationsDataSet.Tables[0].Columns.AddRange(new System.Data.DataColumn[] { column1, column2, column3, column4, column5, column6 });

            // Get the work item controller
            NetworkWorkItemController wiController = WorkItem.Controller as NetworkWorkItemController;
            Asset theAsset = displayedNode.Tag as Asset;

            // ...and from there settings which alter what we display in this view
            bool   showIncluded    = wiController.ShowIncludedApplications;
            bool   showIgnored     = wiController.ShowIgnoredApplications;
            String publisherFilter = wiController.PublisherFilter;

            // Call database function to return list of applications (for the specified publisher)
            ApplicationsDAO lwDataAccess      = new ApplicationsDAO();
            DataTable       applicationsTable = lwDataAccess.GetInstalledApplications(theAsset, publisherFilter, showIncluded, showIgnored);

            foreach (DataRow row in applicationsTable.Rows)
            {
                ApplicationInstance newApplication = new ApplicationInstance(row);
                AddApplication(newApplication);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Update the fields displayed on this form
        /// </summary>
        private void InitializeReport()
        {
            PopulateCustomReportComboBox();
            PopulateCompliantReportComboBox();
            PopulateSQLReportComboBox();

            cmbSoftwareReportType.SelectedIndex = (cmbSoftwareReportType.SelectedIndex == -1) ? 0 : cmbSoftwareReportType.SelectedIndex;
            cmbAssetReportType.SelectedIndex    = (cmbAssetReportType.SelectedIndex == -1) ? 0 : cmbAssetReportType.SelectedIndex;
            cmbAuditReportType.SelectedIndex    = (cmbAuditReportType.SelectedIndex == -1) ? 0 : cmbAuditReportType.SelectedIndex;
            cmbHardwareReportType.SelectedIndex = (cmbHardwareReportType.SelectedIndex == -1) ? 0 : cmbHardwareReportType.SelectedIndex;

            DataTable dataTable = new ApplicationsDAO().GetAllPublisherNamesAsDataTable(String.Empty);

            cmbPublishers.Items.Clear();

            foreach (DataRow row in dataTable.Rows)
            {
                cmbPublishers.Items.Add(row["_PUBLISHER"]);
            }

            if (cmbPublishers.Items.Count > 0)
            {
                cmbPublishers.SelectedIndex = 0;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initialize the 'All Publishers' node of the applications tree
        /// </summary>
        private void InitializeAllPublishers()
        {
            Infragistics.Win.Appearance ignoredAppearance = new Infragistics.Win.Appearance();
            ignoredAppearance.ForeColor = System.Drawing.Color.Gray;

            // Add the publishers to the tree
            try
            {
                ApplicationsWorkItemController wiController = explorerView.WorkItem.Controller as ApplicationsWorkItemController;
                bool showIncluded = wiController.ShowIncludedApplications;
                bool showIgnored  = wiController.ShowIgnoredApplications;

                ApplicationsDAO lApplicationsDAO = new ApplicationsDAO();

                DataTable       dt             = lApplicationsDAO.GetAllPublisherNamesAsDataTable(wiController.PublisherFilter, showIncluded, showIgnored);
                UltraTreeNode[] publisherNodes = new UltraTreeNode[dt.Rows.Count];

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string lPublisher = dt.Rows[i][0].ToString();

                    UltraTreeNode publisherNode = new UltraTreeNode(lPublisher, lPublisher);
                    publisherNode.Tag = "PUBLISHER";
                    publisherNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;
                    publisherNodes[i] = publisherNode;
                }

                explorerView.AllPublishersNode.Nodes.AddRange(publisherNodes);
            }

            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initialize the 'All Operating Systems' node of the applications tree
        /// </summary>
        private void InitializeAllOperatingSystems()
        {
            // Add the entries to the tree
            try
            {
                DataTable       dt = new ApplicationsDAO().GetOperatingSystems();
                UltraTreeNode   osNode;
                UltraTreeNode[] nodes = new UltraTreeNode[dt.Rows.Count];
                InstalledOS     theOS;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    theOS = new InstalledOS(dt.Rows[i]);

                    osNode     = new UltraTreeNode(theOS.Name + "|" + theOS.Version, theOS.Name);
                    osNode.Tag = theOS;
                    osNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;
                    nodes[i] = osNode;
                }

                // Add the OS node (and it's sub-nodes to the tree
                explorerView.AllOperatingSystemsNode.Nodes.AddRange(nodes);
            }

            catch (Exception ex)
            {
                //MessageBox.Show("An exception occurred while populating the list of Operating Systems [InitializeAllOperatingSystems], the exception text was " + ex.Message);
                logger.Error(ex.Message);
            }
        }
Exemplo n.º 8
0
        private void RefreshGrid()
        {
            DataTable aliasTable = new ApplicationsDAO().GetAliasedApplications();

            ultraGrid1.DataSource = aliasTable;
            ultraGrid1.DataBind();
            ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Add("Aliased To Application", false);
        }
Exemplo n.º 9
0
        private void FormSelectApplication_Load(object sender, EventArgs e)
        {
            ApplicationsDAO lwDataAccess      = new ApplicationsDAO();
            DataTable       applicationsTable = lwDataAccess.GetApplications("", true, false);

            //
            foreach (DataRow row in applicationsTable.Rows)
            {
                cbApplications.Items.Add(row["_NAME"]);
            }
        }
Exemplo n.º 10
0
        public int Add()
        {
            //AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess();
            //_applicationID = lwDataAccess.ApplicationAdd(this);

            ApplicationsDAO applicationDAO = new ApplicationsDAO();

            _applicationID = applicationDAO.ApplicationAdd(this);

            return(_applicationID);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Constructor = this takes a publisher filter and will populate the ApplicationPublisherList
        /// </summary>
        /// <param name="forPublisherFilter"></param>
        public ApplicationPublisherList(string forPublisherFilter, bool includeNotIgnore, bool includeIgnore)
        {
            _forPublisherFilter = forPublisherFilter;

            // Now build the list of applications (for the specified publisher)
            // First get a list of the applications which match the publisher filter
            // We will build the list of Publishers as we go along
            ApplicationsDAO lwDataAccess      = new ApplicationsDAO();
            DataTable       applicationsTable = lwDataAccess.GetApplications(_forPublisherFilter, includeNotIgnore, includeIgnore);

            LoadFromTable(applicationsTable);
        }
        /// <summary>
        /// Called to change the publisher for the specified application(s)
        /// </summary>
        public void ChangeApplicationPublisher(List <InstalledApplication> listDroppedApplications, string publisherName)
        {
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();

            foreach (InstalledApplication droppedApplication in listDroppedApplications)
            {
                droppedApplication.Publisher = publisherName;
                lwDataAccess.ApplicationUpdatePublisher(droppedApplication.ApplicationID, publisherName);
            }
            workItem.ExplorerView.RefreshView();
            workItem.GetActiveTabView().RefreshView();
        }
        /// <summary>
        /// Clear the 'hidden' flag for the selected computer(s) within the database
        /// </summary>
        /// <param name="listApplications">list of applications to act on</param>
        public void SetIncluded(List <InstalledApplication> listApplications)
        {
            ILaytonView     applicationsTabView = WorkItem.Items[ViewNames.MainTabView] as ILaytonView;
            ApplicationsDAO lwDataAccess        = new ApplicationsDAO();

            foreach (InstalledApplication application in listApplications)
            {
                lwDataAccess.ApplicationSetIgnored(application.ApplicationID, false);
            }

            if (applicationsTabView != null)
            {
                ((ApplicationsTabView)applicationsTabView).Presenter.DisplayPublishers();
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Called to allow the user to select an application to which this application should be aliased
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnBrowseAlias_Click(object sender, EventArgs e)
        {
            FormSelectPublishersAndApplications form = new FormSelectPublishersAndApplications("", "");

            form.SelectionType = SelectApplicationsControl.eSelectionType.singleapplication;
            form.ShowIgnored   = true;
            form.ShowIncluded  = true;

            if (form.ShowDialog() == DialogResult.OK)
            {
                // Set the alias for this application
                ApplicationsDAO lwDataAccess = new ApplicationsDAO();
                lwDataAccess.ApplicationSetAlias(_installedApplication.ApplicationID, form.SelectedApplication().ApplicationID);
                tbAliasedApplication.Text = form.SelectedApplication().Name;
            }
        }
Exemplo n.º 15
0
        private void PopulatePublisherNodes(string publisherFilter, bool showIncluded, bool showIgnored, UltraTreeNode rootNode, bool showAliasedPublishers)
        {
            rootNode.Override.NodeStyle = NodeStyle.Standard;

            PublisherAliasDAO lPublisherAliasDao       = new PublisherAliasDAO();
            List <string>     existingTargetPublishers = lPublisherAliasDao.SelectAliasedToPublishers();

            // Add the publishers to the tree
            try
            {
                UltraTreeNode publisherNode;

                //DataTable dt = new ApplicationsDAO().GetAllPublisherNamesAsDataTable(publisherFilter);
                DataTable dt = new ApplicationsDAO().GetAllPublisherNamesAsDataTable(publisherFilter, _showIncluded, _showIgnored);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string lPublisher = dt.Rows[i][0].ToString();

                    publisherNode = new UltraTreeNode(rootNode.Key + @"|" + lPublisher, lPublisher);
                    publisherNode.Override.NodeStyle = _selectionType == eSelectionType.all ? NodeStyle.CheckBox : NodeStyle.Standard;
                    publisherNode.Tag = rootNode.Tag;

                    if (!showAliasedPublishers)
                    {
                        if (!existingTargetPublishers.Contains(publisherNode.Text))
                        {
                            rootNode.Nodes.Add(publisherNode);
                        }
                    }
                    else
                    {
                        rootNode.Nodes.Add(publisherNode);
                    }
                }

                rootNode.Expanded = true;
            }

            catch (Exception)
            {
                // JML TODO log this error
            }

            // Expand the root node to show the publishers
            rootNode.Expanded = true;
        }
Exemplo n.º 16
0
        public void ExpandApplications(UltraTreeNode node)
        {
            Infragistics.Win.Appearance ignoredAppearance = new Infragistics.Win.Appearance();
            ignoredAppearance.ForeColor = System.Drawing.Color.Gray;

            ApplicationsWorkItemController wiController = explorerView.WorkItem.Controller as ApplicationsWorkItemController;
            bool showIncluded = wiController.ShowIncludedApplications;
            bool showIgnored  = wiController.ShowIgnoredApplications;

            InstalledApplication theApplication;
            string publisher;
            string key;


            publisher = node.FullPath.Substring(20);
            UltraTreeNode applicationNode;
            DataTable     dt = new ApplicationsDAO().GetApplicationsByPublisher(publisher, showIncluded, showIgnored);

            UltraTreeNode[] applicationNodes = new UltraTreeNode[dt.Rows.Count];

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                theApplication = new InstalledApplication(dt.Rows[j]);
                key            = publisher + "|" + theApplication.Name + "|" + theApplication.ApplicationID;

                if (theApplication.Version == String.Empty || theApplication.Name.EndsWith(theApplication.Version))
                {
                    applicationNode = new UltraTreeNode(key, theApplication.Name);
                }
                else
                {
                    applicationNode = new UltraTreeNode(key, theApplication.Name + " (" + theApplication.Version + ")");
                }

                applicationNode.Tag = theApplication;
                applicationNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;

                if (theApplication.IsIgnored)
                {
                    applicationNode.Override.NodeAppearance = ignoredAppearance;
                }

                applicationNodes[j] = applicationNode;
            }

            node.Nodes.AddRange(applicationNodes);
        }
Exemplo n.º 17
0
        private void FormFilterPublishers_Load(object sender, EventArgs e)
        {
            Application.UseWaitCursor = false;
            string publisherName = "";

            lbFilteredPublishers.EndUpdate();
            lbAvailablePublishers.EndUpdate();
            lbFilteredPublishers.Items.Clear();
            lbAvailablePublishers.Items.Clear();

            // Get the list of publishers currently in the filter list
            SettingsDAO   lwDataAccess         = new SettingsDAO();
            string        publisherFilter      = lwDataAccess.GetPublisherFilter();
            List <String> listFilterPublishers = new List <string>();

            listFilterPublishers.AddRange(publisherFilter.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));

            // Recover a complete list of all publsiher names
            DataTable dtAvailablePublishers = new ApplicationsDAO().GetAllPublisherNames();

            // add <unidentified> publisher if not present
            if (dtAvailablePublishers.Select("_PUBLISHER = '" + DataStrings.UNIDENIFIED_PUBLISHER + "'").Length == 0)
            {
                DataRow uidRow = dtAvailablePublishers.NewRow();
                uidRow["_PUBLISHER"] = DataStrings.UNIDENIFIED_PUBLISHER;
                dtAvailablePublishers.Rows.Add(uidRow);
            }

            // Add the publisher to the appropriate list
            foreach (DataRow row in dtAvailablePublishers.Rows)
            {
                publisherName = row[0].ToString();

                if (!listFilterPublishers.Contains(publisherName))
                {
                    lbAvailablePublishers.Items.Add(publisherName);
                }
                else
                {
                    lbFilteredPublishers.Items.Add(publisherName);
                }
            }

            lbFilteredPublishers.EndUpdate();
            lbAvailablePublishers.EndUpdate();
        }
Exemplo n.º 18
0
        protected void PopulateApplications(UltraTreeNode publisherNode)
        {
            publisherNode.Nodes.Clear();

            string               publisher = publisherNode.FullPath.Substring(20);
            string               key;
            UltraTreeNode        applicationNode;
            InstalledApplication theApplication;

            DataTable dt = new ApplicationsDAO().GetApplicationsByPublisher(publisher, _showIncluded, _showIgnored);

            UltraTreeNode[] applicationNodes = new UltraTreeNode[dt.Rows.Count];

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                theApplication = new InstalledApplication(dt.Rows[j]);

                if (theApplication.Version != String.Empty)
                {
                    key             = publisherNode.Key + @"|" + theApplication.Name + " (v" + theApplication.Version + ")" + "|" + theApplication.ApplicationID;
                    applicationNode = new UltraTreeNode(key, theApplication.Name + " (v" + theApplication.Version + ")");
                }
                else
                {
                    key             = publisherNode.Key + @"|" + theApplication.Name + "|" + theApplication.ApplicationID;
                    applicationNode = new UltraTreeNode(key, theApplication.Name);
                }

                applicationNode.Tag = theApplication;

                if (_selectionType == eSelectionType.singleapplication)
                {
                    applicationNode.Override.NodeStyle = NodeStyle.Standard;
                }
                else
                {
                    applicationNode.Override.NodeStyle = NodeStyle.CheckBox;
                }

                applicationNodes[j] = applicationNode;
            }

            publisherNode.Nodes.AddRange(applicationNodes);
        }
        protected void PopulateApplications(UltraTreeNode publisherNode)
        {
            //publisherNode.Nodes.Clear();

            string        publisher  = publisherNode.FullPath.Substring(32);
            string        appName    = "";
            string        appVersion = "";
            string        key;
            int           appID = -1;
            DataRow       row;
            UltraTreeNode applicationNode;

            DataTable dt = new ApplicationsDAO().GetApplicationsByPublisher(publisher, _showIncluded, _showIgnored);

            UltraTreeNode[] applicationNodes = new UltraTreeNode[dt.Rows.Count];

            for (int j = 0; j < dt.Rows.Count; j++)
            {
                row        = dt.Rows[j];
                appID      = Convert.ToInt32(row["_APPLICATIONID"]);
                appName    = row["_NAME"].ToString();
                appVersion = row["_VERSION"].ToString();

                if (appVersion != String.Empty)
                {
                    //key = publisherNode.Key + @"|" + appName + " (v" + appVersion + ")" + "|" + appID;
                    key             = publisherNode.Key + @"|" + appName + " (v" + appVersion + ")";
                    applicationNode = new UltraTreeNode(key, appName + " (v" + appVersion + ")");
                }
                else
                {
                    //key = publisherNode.Key + @"|" + appName + "|" + appID;
                    key             = publisherNode.Key + @"|" + appName;
                    applicationNode = new UltraTreeNode(key, appName);
                }

                applicationNode.Tag = publisherNode.Tag;
                applicationNode.Override.NodeStyle = _valueNodeStyle;

                applicationNodes[j] = applicationNode;
            }

            publisherNode.Nodes.AddRange(applicationNodes);
        }
Exemplo n.º 20
0
        private void UnaliasApplications()
        {
            int    selectedRows = ultraGrid1.Selected.Rows.Count;
            string messageText;

            if (selectedRows == 0)
            {
                MessageBox.Show(
                    "Please select a row from the aliased applications table.",
                    "Alias Applications",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
                return;
            }

            messageText = (selectedRows == 1) ? "Are you sure you want to delete this alias?" : "Are you sure you want to delete these aliases?";

            if (MessageBox.Show(messageText, "Confirm delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            ApplicationsDAO lApplicationsDAO = new ApplicationsDAO();

            string[] lApplicationDetails;
            string   lSourcePublisher;
            string   lSourceName;
            string   lSourceVersion;
            int      lApplicationId;

            foreach (UltraGridRow row in ultraGrid1.Selected.Rows)
            {
                lApplicationDetails = row.Cells[0].Text.Split('|');

                lSourcePublisher = lApplicationDetails[0].Trim();
                lSourceName      = lApplicationDetails[1].Trim();
                lSourceVersion   = lApplicationDetails[2].Trim();

                lApplicationId = lApplicationsDAO.SelectIdByPublisherNameVersion(lSourcePublisher, lSourceName, lSourceVersion);
                lApplicationsDAO.ApplicationSetAlias(lApplicationId, 0);
            }

            RefreshGrid();
        }
Exemplo n.º 21
0
        protected void InitializeGeneralTab()
        {
            // Populate the window
            tbPublisher.Text = _installedApplication.Publisher;
            tbName.Text      = _installedApplication.Name;
            tbVersion.Text   = _installedApplication.Version;

            // Determine if any applications have been aliased to this application as if so we cannot
            // alias this application to any other.
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();

            if (lwDataAccess.GetAliasCount(_installedApplication.ApplicationID) != 0)
            {
                lblAliasDescription.Enabled  = false;
                lblAliasedTo.Enabled         = false;
                tbAliasedApplication.Enabled = false;
                bnBrowseAlias.Enabled        = false;
            }
        }
        public void DeleteApplication(List <int> applicationIds)
        {
            ApplicationsDAO lApplicationsDAO = new ApplicationsDAO();

            // check if any of the applications are used as an alias - stop if true
            List <string> aliasedApps = lApplicationsDAO.CheckApplicationIsAnAlias(applicationIds);

            if (aliasedApps.Count > 0)
            {
                MessageBox.Show(
                    "The following applications have other applications aliased to them. Please remove the aliases " +
                    "before deleting." + Environment.NewLine + Environment.NewLine + string.Join("\n", aliasedApps.ToArray()),
                    "Delete Application", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            lApplicationsDAO.DeleteApplications(applicationIds);
            WorkItem.ExplorerView.RefreshView();
            WorkItem.TabView.RefreshView();
        }
Exemplo n.º 23
0
        /// <summary>
        /// Called to rebuild the application list for this publisher
        /// </summary>
        public void Populate(bool includeIncluded, bool includeIgnore)
        {
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();

            // First clear any existing entries
            this.Clear();

            // ...then get all applications for this publisher
            DataTable applicationsTable = lwDataAccess.GetApplications(this.Name, includeIncluded, includeIgnore);

            foreach (DataRow row in applicationsTable.Rows)
            {
                InstalledApplication application = new InstalledApplication(row);

                // Load child data for this application
                application.LoadData();

                // ...add to our list
                this.Add(application);
            }
        }
        /// <summary>
        /// Called as we click the OK button - save the definition back to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnOK_Click(object sender, EventArgs e)
        {
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();

            // We need to update the application instance with any changes that the user has made
            ApplicationInstance updatedInstance = new ApplicationInstance(_applicationInstance);

            // Update the publisher first if that has changed
            if (_applicationInstance.Publisher != tbPublisher.Text)
            {
                lwDataAccess.ApplicationUpdatePublisher(_applicationInstance.ApplicationID, tbPublisher.Text);
                _applicationInstance.Publisher = tbPublisher.Text;
            }

            // Update serial number /CD key if specified
            if (updatedInstance.Serial == null)
            {
                updatedInstance.Serial = new ApplicationSerial();
            }
            if (tbSerialNumber.Text != "" || tbCdKey.Text != null)
            {
                updatedInstance.Serial.ProductId = tbSerialNumber.Text;
                updatedInstance.Serial.CdKey     = tbCdKey.Text;
            }

            // ...and update the database if the object has changed
            if (updatedInstance != _applicationInstance)
            {
                new ApplicationInstanceDAO().ApplicationInstanceUpdate(updatedInstance);

                // We need to log any changes made to this definition in the audit trail
                List <AuditTrailEntry> listChanges = updatedInstance.ListChanges(_applicationInstance);
                foreach (AuditTrailEntry thisChange in listChanges)
                {
                    new AuditTrailDAO().AuditTrailAdd(thisChange);
                }
            }
        }
        /// <summary>
        /// Populate the Applications node of the tree with publishers and then applications
        /// </summary>
        /// <param name="rootNode"></param>
        protected void PopulatePublishers(UltraTreeNode rootNode)
        {
            UltraTreeNode[] publisherNodes;
            UltraTreeNode   publisherNode;
            string          lPublisher;

            DataTable dt = new ApplicationsDAO().GetAllPublisherNamesAsDataTable("");

            publisherNodes = new UltraTreeNode[dt.Rows.Count];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                lPublisher = dt.Rows[i][0].ToString();

                publisherNode     = new UltraTreeNode(rootNode.Key + @"|" + lPublisher, lPublisher);
                publisherNode.Tag = rootNode.Tag;
                publisherNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand;

                publisherNodes[i] = publisherNode;
            }

            rootNode.Nodes.AddRange(publisherNodes);
        }
Exemplo n.º 26
0
        public FormSelectPublisher(bool allowNew)
        {
            InitializeComponent();

            // If we are to allow a new publisher to be specified then enable the new button
            bnNewPublisher.Visible = allowNew;

            // Load the publishers into the list
            ApplicationsDAO lwDataAccess    = new ApplicationsDAO();
            DataTable       publishersTable = lwDataAccess.GetPublishers("");

            //
            lvPublishers.BeginUpdate();
            foreach (DataRow row in publishersTable.Rows)
            {
                string publisher = (string)row["_PUBLISHER"];
                if (publisher != "")
                {
                    lvPublishers.Items.Add(new UltraListViewItem(publisher, null));
                }
            }
            lvPublishers.EndUpdate();
        }
Exemplo n.º 27
0
        protected void UpdateFields()
        {
            // Get the Assigned to Application name if required
            if (_displayedFile.AssignApplicationID != 0)
            {
                ApplicationsDAO      lwDataAccess = new ApplicationsDAO();
                InstalledApplication application  = lwDataAccess.GetApplication(_displayedFile.AssignApplicationID);
                if (application != null)
                {
                    tbAssignedApplication.Text = application.Name;
                }

                // Hide the assign stuff then
                panelAssign.Enabled = false;
                bnUnassign.Enabled  = true;
            }
            else
            {
                panelAssign.Enabled        = true;
                bnUnassign.Enabled         = false;
                tbAssignedApplication.Text = String.Empty;
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Constructor = this will populate the InstalledOSList
        /// </summary>
        public InstalledOSList()
        {
            // Now build the list of Operationg Systems
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();
            DataTable       osTable      = lwDataAccess.GetOperatingSystems();

            // Iterate through the returned data
            foreach (DataRow row in osTable.Rows)
            {
                try
                {
                    InstalledOS theOS = new InstalledOS(row);
                    this.Add(theOS);

                    // Read instances of this OS
                    theOS.LoadData();
                }

                catch (Exception)
                {
                    // Just skip the OS as this points to an internal database consistency error
                }
            }
        }