static void Main(string[] args) { Console.WriteLine(new string('*', 30)); Console.WriteLine($"Ключи:\nCommon версия: {ApplicationLicense.common}\nPro версия: {ApplicationLicense.pro}"); Console.WriteLine(new string('*', 30)); Console.Write("Здравствуйте, это программа-калькулятор двоичной, восьмеричной, десятичной и шестнадцатеричной системы счисления\n\n" + "В Пробной (trial) версии доступны операции только с десятичной системой\n" + "В Обычной (common) версии доступны операции с десятичной и двоичной системами счисления\n" + "В Платной (pro) версии доступны операции с десятичной, двоичной, восьмеричной и шестнадцатеричной системами счисления\n\n" + "Введите ключ доступа, если у вас его нет, то вы сможете пользоватся Пробной (trial) версией\n--> "); string code = Console.ReadLine(); if (code != ApplicationLicense.common && code != ApplicationLicense.pro) { ApplicationLicense.AllowTrial(); } else if (code == ApplicationLicense.common) { ApplicationLicense.AllowCommon(); } else { ApplicationLicense.AllowPro(); } }
public void NewLicenses(List <InstalledApplication> aForApplications) { // Create a new license and then call the license form to define it ApplicationLicense newLicense = new ApplicationLicense(); FormLicenseProperties form = new FormLicenseProperties("Multiple Applications", newLicense); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ApplicationLicense lNewApplicationLicense = form.GetLicense; foreach (InstalledApplication lForApplication in aForApplications) { lNewApplicationLicense.LicenseID = 0; lNewApplicationLicense.ApplicationID = lForApplication.ApplicationID; lNewApplicationLicense.ApplicationName = lForApplication.Name; lNewApplicationLicense.Add(); // Update this installed application with the new license lForApplication.LoadData(); } // The license will have been added to the application already so we simply refresh the views workItem.ExplorerView.RefreshView(); workItem.GetActiveTabView().RefreshView(); ILaytonView applicationsTabView = WorkItem.Items[Layton.Cab.Interface.ViewNames.MainTabView] as ILaytonView; ((ApplicationsTabView)applicationsTabView).Presenter.DisplayPublishers(); } }
protected void DeleteLicense() { // Sanity check ensure only row selected if (licensesGridView.Selected.Rows.Count == 0) { return; } foreach (UltraGridRow selectedRow in this.licensesGridView.Selected.Rows) { //...and get the license object //UltraGridRow selectedRow = this.licensesGridView.Selected.Rows[0]; ApplicationLicense theLicense = selectedRow.Cells[0].Value as ApplicationLicense; // Get our controller ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; // ...and request it to delete the currently selected license wiController.DeleteLicense(theLicense); } // refresh the tab view ApplicationsWorkItem appWorkItem = WorkItem as ApplicationsWorkItem; appWorkItem.ExplorerView.RefreshView(); appWorkItem.GetActiveTabView().RefreshView(); }
/// <summary> /// Add a new application license to the data set to be displayed /// </summary> /// <param name="thisComputer"></param> public void AddApplicationLicense(ApplicationLicense theLicense) { DataRow thisRow = licensesDataSet.Tables[0].Rows.Add(new object[] { theLicense , theLicense.LicenseTypeName , (theLicense.UsageCounted) ? "Yes" : "No" , theLicense.Count }); }
public FormLicenseProperties(String applicationName, ApplicationLicense theLicense) { InitializeComponent(); _applicationName = applicationName; _applicationLicense = theLicense; // Set the link types for the Supplier Email and Web Site fields tbSupplierContactEmail.LinkType = Layton.Common.Controls.LinkTypes.Email; tbSupplierWWW.LinkType = Layton.Common.Controls.LinkTypes.Http; }
/// <summary> /// Save any changes made on the Support Contract tab /// </summary> /// <param name="updatedLicense"></param> private void SaveSupportContractTab(ApplicationLicense updatedLicense) { // Support Information updatedLicense.Supported = cbSupported.Checked; if (updatedLicense.Supported) { updatedLicense.SupportExpiryDate = deSupportExpiryDate.DateTime; updatedLicense.SupportAlertDays = (cbSupportAlert.Checked) ? (int)nupSupportDays.Value : -1; updatedLicense.SupportAlertEmail = cbSupportAlertEmail.Checked; } }
/// <summary> /// Return the ApplicationLicense object associated with the currently selected row /// </summary> /// <returns></returns> public ApplicationLicense GetSelectedLicense() { if (licensesGridView.Selected.Rows.Count == 0) { return(null); } UltraGridRow selectedRow = this.licensesGridView.Selected.Rows[0]; ApplicationLicense theLicense = selectedRow.Cells[0].Value as ApplicationLicense; return(theLicense); }
private void EditApplicationLicense(ApplicationLicense theLicense, InstalledOS aSelectedOS) { FormLicenseProperties form = new FormLicenseProperties(aSelectedOS.Name, theLicense); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { aSelectedOS.LoadData(); // The license will have been added to the application already so we simply refresh the active tab view 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) { // Take a copy of the source license (if any) so that we know what changes have been // made. We can then check these later ApplicationLicense updatedLicense = new ApplicationLicense(_applicationLicense); // Save any changes made on the General tab SaveLicenseTab(updatedLicense); // Save Support Contract Tab SaveSupportContractTab(updatedLicense); // Save Supplier Tab SaveSupplierTab(updatedLicense); // Update the definition with entered values remembering that we need to audit any // changes so that we know hat has happened and when LicenseType licenseType = cbLicenseType.SelectedItem.DataValue as LicenseType; updatedLicense.LicenseTypeID = licenseType.LicenseTypeID; updatedLicense.LicenseTypeName = licenseType.Name; updatedLicense.UsageCounted = licenseType.PerComputer; updatedLicense.Count = (int)nupLicenseCount.Value; // ...and update the database if the object has changed updatedLicense.Update(_applicationLicense); // update any notes in notesControl with the new found application license id foreach (Note note in notesControl.Notes) { if (note.ParentID == 0) { note.ParentID = updatedLicense.LicenseID; note.Scope = SCOPE.License; note.Update(); } } // same for documents foreach (Document document in documentsControl.Documents) { if (document.ParentID == 0) { document.ParentID = updatedLicense.LicenseID; document.Scope = SCOPE.License; document.Update(); } } _applicationLicense = updatedLicense; }
/// <summary> /// Wrapper around the main EditLicense function which does the work. Here we simply recover /// the licencse currently selected in the explorer view. The tab view call the extended version /// of this function which takes the license itself as a parameter /// </summary> public void EditLicense() { // Recover the license that is to be edited from the LicenseTabView ILaytonView tabView = (ILaytonView)WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].ActiveSmartPart; if (tabView is LicensesTabView) { LicensesTabView licensesTabView = (LicensesTabView)tabView; ApplicationLicense theLicense = licensesTabView.GetSelectedLicense(); if (theLicense == null) { return; } EditLicense(theLicense); } }
/// <summary> /// Load licenses for this application from the supplied DataTable /// </summary> /// <param name="licensesTable"></param> protected void LoadLicenses(DataTable licensesTable) { _listLicenses.Clear(); foreach (DataRow row in licensesTable.Rows) { try { ApplicationLicense newLicense = new ApplicationLicense(row); _listLicenses.Add(newLicense); } catch (Exception) { // Just skip the license as this points to an internal database consistency error } } }
/// <summary> /// Called to edit the currently selected license (if any) /// </summary> protected void EditLicense() { // Sanity check ensure only row selected if (licensesGridView.Selected.Rows.Count != 1) { return; } //...and get the license object UltraGridRow selectedRow = this.licensesGridView.Selected.Rows[0]; ApplicationLicense theLicense = selectedRow.Cells[0].Value as ApplicationLicense; // Get our controller ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; // ...and request it to edit the currently selected license wiController.EditLicense(theLicense); }
/// <summary> /// Called to initiate the editing of an existing license /// Note that this is only applicable if we are displaying the LicenseTabView /// </summary> public void EditLicense(ApplicationLicense theLicense) { // Get details of the currently selected application or OS entry List <InstalledApplication> selectedApplications = GetSelectedApplications(); List <InstalledOS> selectedOSs = GetSelectedOSs(); if (selectedApplications != null) { EditApplicationLicense(theLicense, selectedApplications[0]); } else { if (selectedOSs != null) { EditApplicationLicense(theLicense, selectedOSs[0]); } } }
/// <summary> /// Add a license for an application to the Licenses table /// </summary> /// <param name="thisLicense"></param> protected void AddLicense(ApplicationLicense thisLicense) { DataTable licenseTable = _reportDataSet.Tables["Licenses"]; try { licenseTable.Rows.Add(new object[] { thisLicense , thisLicense.ApplicationID , thisLicense.LicenseID , thisLicense.LicenseTypeName , thisLicense.UsageCounted , thisLicense.Count }); } catch (Exception e) { MessageBox.Show(e.Message); } }
/// <summary> /// Wrapper around the main EditLicense function which does the work. Here we simply recover /// the licencse currently selected in the explorer view. The tab view call the extended version /// of this function which takes the license itself as a parameter /// </summary> public void DeleteLicense() { ILaytonView tabView = (ILaytonView)WorkItem.RootWorkItem.Workspaces[WorkspaceNames.TabWorkspace].ActiveSmartPart; if (tabView is LicensesTabView) { // Recover the license that is to be edited from the LicenseTabView LicensesTabView licensesTabView = (LicensesTabView)tabView; ApplicationLicense theLicense = licensesTabView.GetSelectedLicense(); if (theLicense == null) { return; } DeleteLicense(theLicense); } // refresh the tab view workItem.ExplorerView.RefreshView(); workItem.GetActiveTabView().RefreshView(); }
public async Task <IActionResult> Add(AddLicenseModel model) { if (!ModelState.IsValid) { ViewBag.Products = await dbContext.Products .AsNoTracking() .ToListAsync(); return(View()); } var product = dbContext.Products.Find(model.Id); if (product == null) { ModelState.AddModelError("", "Selected product not longer exists."); ViewBag.Products = await dbContext.Products .AsNoTracking() .ToListAsync(); return(View()); } for (int i = 0; i < model.Count; i++) { var license = new ApplicationLicense { Key = Guid.NewGuid().ToString(), Product = product }; await dbContext.AddAsync(license); } await dbContext.SaveChangesAsync(); return(Redirect("~/License/")); }
/// <summary> /// Called to allow a new application license to be defined /// Note that this is only applicable if we are displaying the LicenseTabView or have selected an /// application in the explorer view /// </summary> /// <param name="theApplication"></param> public void NewLicense(InstalledOS aOS) { // Create a new license and then call the license form to define it ApplicationLicense newLicense = new ApplicationLicense(); newLicense.ApplicationID = aOS.OSid; newLicense.ApplicationName = aOS.Name; // FormLicenseProperties form = new FormLicenseProperties(aOS.Name, newLicense); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { // Update this installed application with the new license aOS.LoadData(); // The license will have been added to the application already so we simply refresh the views //workItem.ExplorerView.RefreshView(); workItem.GetActiveTabView().RefreshView(); //ILaytonView applicationsTabView = WorkItem.Items[Layton.Cab.Interface.ViewNames.MainTabView] as ILaytonView; //((ApplicationsTabView)applicationsTabView).Presenter.DisplayPublishers(); } }
/// <summary> /// Save any changes made on the Support Contract tab /// </summary> /// <param name="updatedLicense"></param> private void SaveSupplierTab(ApplicationLicense updatedLicense) { Supplier theSupplier = cbSuppliers.SelectedItem.DataValue as Supplier; // If there is no supplier index this means that we are creating the supplier if (theSupplier.SupplierID == 0) { theSupplier.Name = cbSuppliers.Text; theSupplier.AddressLine1 = tbSupplierAddress1.Text; theSupplier.AddressLine2 = tbSupplierAddress2.Text; theSupplier.City = tbSupplierCity.Text; theSupplier.State = tbSupplierState.Text; theSupplier.Zip = tbSupplierZip.Text; theSupplier.Telephone = tbSupplierTelephone.Text; theSupplier.Contact = tbSupplierContactName.Text; theSupplier.Email = tbSupplierContactEmail.Text; theSupplier.Fax = tbSupplierFax.Text; theSupplier.WWW = tbSupplierWWW.Text; } // Add or update the supplier theSupplier.Update(null); updatedLicense.SupplierID = theSupplier.SupplierID; }
private void SaveItembutton_Click(object sender, EventArgs e) { if (cmbItem.SelectedItem == null) { MessageBox.Show("Select Item!!"); } else if (cmbBrandName.SelectedItem.ToString() == "") { MessageBox.Show("Write Brand"); } else { Item d = null; string Itemname = cmbItem.SelectedItem.ToString(); //MessageBox.Show(Itemname); if (Itemname == ProductName.Dongle3G.ToString()) { d = new Dongle3G(); } else if (Itemname == ProductName.Laptop.ToString()) { d = new Laptop(); } else if (Itemname == ProductName.HeadPhone.ToString()) { d = new HeadPhone(); } else if (Itemname == ProductName.OS_License.ToString()) { d = new OS_License(); } else if (Itemname == ProductName.Antivirus.ToString()) { d = new AntiVirus(); } else if (Itemname == ProductName.Application_License.ToString()) { d = new ApplicationLicense(); } try { d.Brand = cmbBrandName.SelectedItem.ToString(); d.CreationDate = CreationDateTimePicker.Value; // d.ActualExpiryDate = ActualExpiryTimePicker.Value; d.WarrantyExpiration = WarrantyExpiryTimePicker.Value; d.WarrantyExists = "True"; d.IsAssigned = "False"; itemhelper.Save(d, productFilePath); MessageBox.Show("Item Added"); // MessageBox.Show(); ItInfrastructureManagementLoad(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
/// <summary> /// Called to initiate the deletion of an existing license /// </summary> public void DeleteLicense(ApplicationLicense theLicense) { // Delete the license from the database theLicense.Delete(); }
/// <summary> /// Save the data entered on the license tab /// </summary> /// <param name="updatedLicense"></param> private void SaveLicenseTab(ApplicationLicense updatedLicense) { }