/// <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> /// 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> /// 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); } } }