public List <ModuloDTO> GetByLicense(LicencaDTO dto) { var modulesList = ObterTodosModulos(); if (dto.LicType == "GF") { modulesList.Where(t => t.Codigo == 1 || t.Codigo == 8).ToList(); } else if (dto.LicType == "GP") { modulesList.Where(t => t.Codigo == 1 || t.Codigo == 2 || t.Codigo == 12 || t.Codigo == 8).ToList(); } else if (dto.LicType == "GC") { modulesList.Where(t => t.Codigo == 1 || t.Codigo == 2 || t.Codigo == 12 || t.Codigo == 8).ToList(); } else if (dto.LicType == "GL") { modulesList.Where(t => t.Codigo == 1 || t.Codigo == 2 || t.Codigo == 12 || t.Codigo == 8).ToList(); } else { modulesList = new List <ModuloDTO>(); } return(modulesList); }
public LicencaDTO Inserir(LicencaDTO dto) { try { BaseDados.ComandText = "stp_SIS_LICENCA_NOVO"; BaseDados.AddParameter("@CODIGO", dto.LicenseID); BaseDados.AddParameter("@FILIAL", dto.Filial); BaseDados.AddParameter("@VALIDATE", dto.ValidateDate); BaseDados.AddParameter("@FISCAL_YEAR", dto.FiscalYear); BaseDados.AddParameter("@GENERATION", dto.GenereatedDate); BaseDados.AddParameter("@HOSTNAME", dto.HostName); BaseDados.AddParameter("@MACADDRESS", dto.HostMacAddress); BaseDados.AddParameter("@ESTADO", dto.Status); BaseDados.AddParameter("@DESCRIPTION", dto.LookupNumericField1); BaseDados.AddParameter("@LICENSE_TYPE", dto.LicType); BaseDados.ExecuteNonQuery(); } catch (Exception ex) { dto.MensagemErro = ex.Message.Replace("'", ""); } finally { BaseDados.FecharConexao(); } return(dto); }
public Tuple <bool, string> GetSystemValidLicense(LicencaDTO dto) { dto.HostName = Encrypt(dto.HostName); var licenseInfo = dao.ObterPorLicencaValida(dto); if (dto.Sucesso) { } return(new Tuple <bool, string>(licenseInfo.Sucesso, licenseInfo.MensagemErro)); }
public LicencaDTO ObterPorLicencaValida(LicencaDTO dto) { try { BaseDados.ComandText = "stp_SIS_LICENCA_OBTERVALIDA"; BaseDados.AddParameter("@SERVER_NAME", dto.HostName); MySqlDataReader dr = BaseDados.ExecuteReader(); dto = new LicencaDTO(); if (dr.Read()) { dto.LicenseID = dr[0].ToString(); dto.Filial = dr[1].ToString(); dto.ValidateDate = dr[2].ToString(); dto.FiscalYear = dr[3].ToString(); dto.GenereatedDate = dr[4].ToString(); dto.HostName = dr[5].ToString(); dto.HostMacAddress = dr[6].ToString(); dto.Status = int.Parse(dr[7].ToString()); dto.MensagemErro = dr[8].ToString(); dto.LicType = dr[10].ToString(); dto.Sucesso = true; } else { dto.Sucesso = false; dto.MensagemErro = "Licença Inválida"; } } catch (Exception ex) { dto.MensagemErro = ex.Message.Replace("'", ""); dto.Sucesso = false; } finally { BaseDados.FecharConexao(); } return(dto); }
internal LicencaDTO GenerateLicense(LicencaDTO dto, string pFilePath) { try { dto.HostMacAddress = getMacByIp(dto.HostMacAddress); dto.LicenseID = Encrypt(dto.Filial + "_" + dto.HostMacAddress + "_" + dto.HostName + "_" + DateTime.Today.Date); dto.FiscalYear = Encrypt(DateTime.Today.Year.ToString()); dto.ValidateDate = Encrypt(new DateTime(DateTime.Today.Year, 12, 1).ToString()); dto.HostMacAddress = Encrypt(dto.HostMacAddress); dto.HostName = Encrypt(dto.HostName); dto.GenereatedDate = Encrypt(DateTime.Now.ToString()); dto.Status = 1; dto = dao.Inserir(dto); if (!string.IsNullOrEmpty(dto.HostMacAddress)) { using (FileStream fs = File.Create(pFilePath)) { using (StreamWriter sw = new StreamWriter(pFilePath)) { // Add some information to the file. sw.Write(Encrypt(new JavaScriptSerializer().Serialize(dto).ToString())); } } } else { dto.MensagemErro = "Erro Durante a verificação da Licença: Endereço Físico não carregado "; } } catch (Exception ex) { dto.MensagemErro = "Erro Durante a verificação da Licença: " + ex.Message.Replace("'", ""); } return(dto); }
public void AddLic(LicencaDTO dto) { dao.Inserir(dto); }