public Boolean LicenseIsAvailable(License license) { StartDBAccess(); LicenseDAO licenseDAO = new LicenseDAO(dataAccess.GetConnection()); License storedLicense = licenseDAO.GetLicense(license.tenantId, license.id); FinishDBAccess(); // A licença não existe if (storedLicense == null) { return(false); } // A licença está disponível if (String.IsNullOrEmpty(storedLicense.installationKey)) { return(true); } // Verifica se o produto esta sendo reinstalado, neste caso "installationKey" permanecerá o mesmo, // a licença é reaproveitada if (license.installationKey.ToUpper() == storedLicense.installationKey.ToUpper()) { return(true); } // Caso não se enquadre em nenhum dos anteriores a licença está em uso por outra workstation return(false); }
protected void Page_Load(Object sender, EventArgs e) { administratorMasterPage = (AdministratorMasterPage)Page.Master; administratorMasterPage.AddMenuItems(); administratorMasterPage.InitializeMasterPageComponents(); TenantDAO tenantDAO = new TenantDAO(administratorMasterPage.dataAccess.GetConnection()); LicenseDAO licenseDAO = new LicenseDAO(administratorMasterPage.dataAccess.GetConnection()); String[] columnNames = new String[] { "Empresa", "Quantidade de Licenças" }; String addScript = "window.open('AddLicenses.aspx?tenantId=' + {0}, 'AddLicenses', 'width=540,height=600');"; EditableListButton[] buttons = new EditableListButton[] { // Botões que devem aparecer para os items da lista new EditableListButton("Adicionar", addScript, ButtonTypeEnum.Edit) }; EditableList editableList = new EditableList(configurationArea, columnNames, buttons); List <Object> tenantList = tenantDAO.GetAllTenants(); foreach (Tenant tenant in tenantList) { String[] itemProperties = new String[] { tenant.alias, licenseDAO.GetAllLicenses(tenant.id).Count.ToString() }; editableList.InsertItem(tenant.id, false, itemProperties); } editableList.DrawList(); }
public LicenseManager(AssemblyDAO asmDAO, FileUpdate fileUpdate, LicenseDAO licenseDAO) { this.licenseDAO = licenseDAO; this.asmDAO = asmDAO; this.fileUpdate = fileUpdate; }
public void LicenseDAOConstructorTest() { /*Context*/ AccountDAO acc_context = new AccountDAO(); LicenseDAO lic_context = new LicenseDAO(); /*Insert*/ AccountDTO acc = new AccountDTO(); acc.userName = "******"; acc.password = "******"; acc.accountType = "administrator"; acc.status = "active"; acc_context.presist(acc); LicenseDTO lic = new LicenseDTO(); lic.userName = "******"; lic.type = "car"; lic_context.presist(lic); Assert.AreEqual(lic.type, lic_context.find("john","car").type); /*Update*/ //N/A /*Delete*/ lic_context.removeByUserId("john","car"); Assert.AreEqual(lic_context.isFound("john","car"), false); acc_context.removeByUserId("john"); }
public IssueStatementHandler() { statement = new Statement(); licenseDAO = new LicenseDAO(); statementDAO = new IssueStatementDAO(); // needed any more? it is created in function!!! lawDAO = new LawDAO(); licensesNeeded = new List <string>(); laws = new List <Law>(); }
public void SetLicense(License license) { StartDBAccess(); LicenseDAO licenseDAO = new LicenseDAO(dataAccess.GetConnection()); licenseDAO.SetLicense(license); FinishDBAccess(); }
protected void btnAdd_Click(Object sender, EventArgs e) { LicenseDAO linceseDAO = new LicenseDAO(administratorMasterPage.dataAccess.GetConnection()); License license = new License(); license.id = 0; // adicionar uma nova licença String ammount = ""; foreach (String fieldName in Request.Form) { if (fieldName.Contains("txtId")) { license.tenantId = int.Parse(Request.Form[fieldName]); } if (fieldName.Contains("txtAmmount")) { ammount = Request.Form[fieldName]; } } int licenseAmmount = 0; Boolean isNumeric = int.TryParse(ammount, out licenseAmmount); if (!isNumeric) { EmbedClientScript.ShowErrorMessage(this, "Os valores informados não estão em um formato válido!"); return; } if (licenseAmmount < 1) { EmbedClientScript.ShowErrorMessage(this, "Quantidade inválida!"); return; } for (int index = 0; index < licenseAmmount; index++) { linceseDAO.SetLicense(license); } EmbedClientScript.CloseWindow(this); }
protected void Page_Load(Object sender, EventArgs e) { accountingMasterPage = (AccountingMasterPage)Page.Master; accountingMasterPage.InitializeMasterPageComponents(); if (!Authorization.AuthorizedAsAdministrator(Session)) { // Mostra aviso de falta de autorização ShowWarning(Authorization.GetWarning()); return; } Tenant tenant = (Tenant)Session["tenant"]; LicenseDAO licenseDAO = new LicenseDAO(accountingMasterPage.dataAccess.GetConnection()); List <Object> licenseList = licenseDAO.GetAllLicenses(tenant.id); String[] columnNames = new String[] { "Id da Licença", "Chave Instalação(CPU/HD)", "Data Instalação", "Nome do Computador" }; String downloadScript = "window.location.replace('LicenseFile.aspx?licenseId=' + {0});"; EditableListButton[] buttons = new EditableListButton[] { // Botões que devem aparecer para os items da lista new EditableListButton("Download", downloadScript, ButtonTypeEnum.Download) }; EditableList editableList = new EditableList(displayArea, columnNames, buttons); foreach (License license in licenseList) { String licenseId = license.id.ToString(); if (license.id < 10000) { licenseId = String.Format("{0:0000}", license.id); } String installationKey = "-"; if (license.installationKey != null) { installationKey = license.installationKey; } String installationDate = "-"; if (license.installationDate != null) { installationDate = license.installationDate.Value.ToString("dd/MM/yyyy"); } String computerName = "-"; if (license.computerName != null) { computerName = license.computerName; } String[] licenseProperties = new String[] { licenseId, installationKey, installationDate, computerName }; editableList.InsertItem(license.id, false, licenseProperties); } editableList.DrawList(); }
public LicenseVerifyAddin(LicenseDAO licenseDAO, SAPbouiCOM.Application sapApp) { this.licenseDAO = licenseDAO; this.sapApp = sapApp; }