private CLicenseManager(string softwareName, string identifier, bool useRegistryString) { _SoftName = softwareName; _Identifier = identifier; SetDefaults(useRegistryString); //FileInfo fi_comp = new FileInfo(SystemVariables.MyCommonApplicationData + @"\" + softwareName + "_comp.lic"); //if (fi_comp.Exists) //{ // try // { // StreamReader sr = new StreamReader(fi_comp.FullName, Encoding.ASCII); // string xml = sr.ReadToEnd(); // sr.Close(); // xml = Crypto.Decrypt(xml, _cryptoPassword.ToString("N")).Trim(); // XmlDocument doc = new XmlDocument(); // doc.LoadXml(xml); // XmlNode compLicense = doc.SelectSingleNode("CompanyLicense[@Name and @Street and @ZipCode and @City and @Country]"); // _companyName = FromUnicodeBase64(compLicense.Attributes["Name"].Value); // _companyStreet = FromUnicodeBase64(compLicense.Attributes["Street"].Value); // _companyZipCode = FromUnicodeBase64(compLicense.Attributes["ZipCode"].Value); // _companyCity = FromUnicodeBase64(compLicense.Attributes["City"].Value); // _companyCountry = FromUnicodeBase64(compLicense.Attributes["Country"].Value); // _hasCompanyLicense = true; // } // catch // { // } //} FileInfo fi = new FileInfo(SystemVariables.MyCommonApplicationData + @"\" + softwareName + ".lic"); if (fi.Exists) { try { StreamReader sr = new StreamReader(fi.FullName); string xml = sr.ReadToEnd(); sr.Close(); xml = Crypto.Decrypt(xml, _cryptoPassword.ToString("N")); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlNode license = doc.SelectSingleNode("License[@pwd]"); if (_Password == license.Attributes["pwd"].Value) { if (license.Attributes["lic"] != null) { _licName = license.Attributes["lic"].Value; } foreach (XmlNode comp in doc.SelectNodes("License/Components/comp[@name]")) { _components.Add(comp.Attributes["name"].Value.ToLower()); } _runType = LicenseTypes.Licensed; } else // falsches Passwort { _runType = LicenseTypes.Unknown; return; } } catch { _runType = LicenseTypes.Unknown; } } if (_runType == LicenseTypes.Unknown) { //DateTime t1 = SystemVariables.InstallationTime; //TimeSpan ts = DateTime.Now - t1; //if (ts.Days <= _durationDays) //{ // _runType = LicenseTypes.Express; //} //else //{ // _runType = LicenseTypes.Expired; //} _runType = LicenseTypes.Express; } }
public KeygenProduct(LicenseTypes licence, string description, string platform) { Licence = licence; Description = description + " for " + platform; }
//For Reseller public List <Models.GridPriceList> GetForReseller(int Id) { try { var db = new Context.ConnectionStringsContext(); var query = (from p in db.MicrosoftPriceList //join rp in db.ResellerPrice //on p.MicrosoftId equals rp.MicrosoftId //into rps //from rp in rps.DefaultIfEmpty() where p.Status == true //&& rp.ResellerId == Id group p by p.MicrosoftId into op select new { MicrosoftId = op.Key, Name = op.Max(x => x.Name), StartDate = op.Max(x => x.StartDate), EndDate = op.Max(x => x.EndDate), Price = op.Max(x => x.Price), ResellerPrice = db.ResellerPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id && m.Status == true) ? db.ResellerPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id && m.Status == true).OrderByDescending(m => m.Id).FirstOrDefault().Price : (db.ResellerCustomersPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0 && m.ResellerPrice != null)) ? db.ResellerCustomersPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0).OrderByDescending(m => m.Id).FirstOrDefault().ResellerPrice : 0, CustomerPrice = (db.CustomerPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id)) ? (db.CustomerPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id)).OrderByDescending(m => m.Id).FirstOrDefault().Price : (db.ResellerCustomersPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id && m.CustomerPrice != null)) ? db.ResellerCustomersPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == Id).OrderByDescending(m => m.Id).FirstOrDefault().CustomerPrice : op.Max(x => x.CustomerPrice), AgreementType = op.Max(x => x.AgreementType), CustomerType = op.Max(x => x.CustomerType), LicenseType = op.Max(x => x.LicenseType), PurchaseUnit = op.Max(x => x.PurchaseUnit), PurchaseUnitNumber = op.Max(x => x.PurchaseUnitNumber), Id = op.Max(x => x.Id), DefaultMarginReseller = db.Resellers.Where(m => m.Id == Id).FirstOrDefault().Margin //get the margin from reseller table }).ToList(); List <Models.GridPriceList> mic = query.ToList().Select(r => new Models.GridPriceList { EndDate = r.EndDate, Id = r.Id, MicrosoftId = r.MicrosoftId, Name = r.Name, StartDate = r.StartDate, // Date = r.StartDate.Date + "<br/> "+r.EndDate.Date, Price = r.Price, AgreementType = AgreementTypes.ParseEnumToString <AgreementType>(r.AgreementType), CustomerType = CustomerTypes.ParseEnumToString <CustomerType>(r.CustomerType), LicenseType = LicenseTypes.ParseEnumToString <LicenseType>(r.LicenseType), ResellerPrice = (double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100), ResellerPricePercentage = ((double)System.Math.Round(((double)((((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100)) - r.Price) * 100) / r.Price), 2)).ToString(), //((double)System.Math.Round(((double)((((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.CustomerPrice - (r.CustomerPrice * r.DefaultMarginReseller) / 100)) - r.Price) * 100) / r.Price), 2)).ToString(), CustomerPrice = r.CustomerPrice, CustomerPricePercentage = ((double)System.Math.Round((((r.CustomerPrice - ((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100))) * 100) / ((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100))), 2)).ToString(), PurchaseUnit = r.PurchaseUnitNumber + " " + PurchaseUnits.ParseEnumToString <PurchaseUnit>(r.PurchaseUnit), //PurchaseUnitNumber = r.PurchaseUnitNumber, DefaultMarginReseller = (double)r.ResellerPrice != 0 ? ((double)(( ((double)System.Math.Round((((r.CustomerPrice - r.Price) * 100) / r.Price), 2)) - ((double)System.Math.Round(((double)((((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100)) - r.Price) * 100) / r.Price), 2))) * 100 ) / ((double)(((double)System.Math.Round((((r.CustomerPrice - r.Price) * 100) / r.Price), 2)))) ).ToString() : r.DefaultMarginReseller.ToString() }).OrderBy(m => m.Name).ToList(); return(mic); } catch { return(new List <Models.GridPriceList>()); } }
public HttpResponseMessage SaveLicenseTypes(LicenseTypes b) { //LogTraceWriter traceWriter = new LogTraceWriter(); //traceWriter.Trace(Request, "0", TraceLevel.Info, "{0}", "SaveLicenseTypes credentials...."); SqlConnection conn = new SqlConnection(); try { //connect to database //connetionString="Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password" conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["btposdb"].ToString(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "InsUpdLicenseTypes"; cmd.Connection = conn; conn.Open(); SqlParameter Aid = new SqlParameter(); Aid.ParameterName = "@Id"; Aid.SqlDbType = SqlDbType.Int; Aid.Value = Convert.ToString(b.Id); cmd.Parameters.Add(Aid); SqlParameter lid = new SqlParameter(); lid.ParameterName = "@LicenseCatId"; lid.SqlDbType = SqlDbType.Int; lid.Value = Convert.ToString(b.LicenseCategoryId); cmd.Parameters.Add(lid); SqlParameter ss = new SqlParameter(); ss.ParameterName = "@LicenseType"; ss.SqlDbType = SqlDbType.VarChar; ss.Value = b.LicenseType; cmd.Parameters.Add(ss); SqlParameter ii = new SqlParameter(); ii.ParameterName = "@Description"; ii.SqlDbType = SqlDbType.VarChar; ii.Value = b.Desc; cmd.Parameters.Add(ii); SqlParameter ll = new SqlParameter(); ll.ParameterName = "@Active"; ll.SqlDbType = SqlDbType.VarChar; ll.Value = b.Active; cmd.ExecuteScalar(); conn.Close(); //traceWriter.Trace(Request, "0", TraceLevel.Info, "{0}", "SaveLicenseTypes Credentials completed."); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); } string str = ex.Message; //traceWriter.Trace(Request, "1", TraceLevel.Info, "{0}", "Error in SaveLicenseTypes:" + ex.Message); return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex)); } }
public WebmailKeygenerator(LicenseTypes licenseType, DateTime expireDate, int userLimit = 0) { _licenseType = licenseType; _expireDate = expireDate; _userLimit = userLimit; }
//For Admin (Overall price list => ResellerPrice > MicrosoftPriceList) public List <Models.GridPriceList> GetGridPriceListForAdmin() { //IEnumerable<MicrosoftOffer> microsoftOffers = await ApplicationDomain.Instance.OffersRepository.RetrieveMicrosoftOffersAsync().ConfigureAwait(false); try { var db = new Context.ConnectionStringsContext(); var query = (from p in db.MicrosoftPriceList // join where p.Status == true group p by p.MicrosoftId into op select new { MicrosoftId = op.Key, Name = op.Max(x => x.Name), StartDate = op.Max(x => x.StartDate), EndDate = op.Max(x => x.EndDate), Price = op.Max(x => x.Price), ResellerPrice = (db.ResellerCustomersPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0 && m.ResellerPrice != null)) ? db.ResellerCustomersPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0).OrderByDescending(m => m.Id).FirstOrDefault().ResellerPrice : 0, //op.Max(x => x.CustomerPrice) - (op.Max(x => x.CustomerPrice) * (db.DefaultMargin.Where(m => m.ResellerId == 0 && m.Role == (int)Roles.Resellers).FirstOrDefault().DefaultPercentage)) / 100, //ResellerPrice = (db.ResellerCustomersPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0 && m.ResellerPrice != null)) ? // db.ResellerCustomersPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0).FirstOrDefault().ResellerPrice // : op.Max(x => x.ResellerPrice), CustomerPrice = (db.ResellerCustomersPrice.Any(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0 && m.CustomerPrice != null)) ? db.ResellerCustomersPrice.Where(m => m.PriceId == op.Max(x => x.Id) && m.ResellerId == 0).OrderByDescending(m => m.Id).FirstOrDefault().CustomerPrice : op.Max(x => x.CustomerPrice), AgreementType = op.Max(x => x.AgreementType), CustomerType = op.Max(x => x.CustomerType), LicenseType = op.Max(x => x.LicenseType), PurchaseUnit = op.Max(x => x.PurchaseUnit), PurchaseUnitNumber = op.Max(x => x.PurchaseUnitNumber), Id = op.Max(x => x.Id), DefaultMarginReseller = db.DefaultMargin.Where(m => m.ResellerId == 0 && m.Role == (int)Roles.Resellers).FirstOrDefault().DefaultPercentage }).ToList(); List <Models.GridPriceList> mic = query.ToList().Select(r => new Models.GridPriceList { EndDate = r.EndDate, Id = r.Id, MicrosoftId = r.MicrosoftId, Name = r.Name, StartDate = r.StartDate, // Date = r.StartDate.Date + "<br/> "+r.EndDate.Date, Price = r.Price, AgreementType = AgreementTypes.ParseEnumToString <AgreementType>(r.AgreementType), CustomerType = CustomerTypes.ParseEnumToString <CustomerType>(r.CustomerType), LicenseType = LicenseTypes.ParseEnumToString <LicenseType>(r.LicenseType), ResellerPrice = (double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100), ResellerPricePercentage = ((double)System.Math.Round(((double)((( (double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100) ) - r.Price) * 100) / r.Price), 2)).ToString(), //ResellerPrice = (double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.CustomerPrice - (r.CustomerPrice * r.DefaultMarginReseller) / 100), //ResellerPricePercentage = ((double)System.Math.Round(((double)((((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.CustomerPrice - (r.CustomerPrice * r.DefaultMarginReseller) / 100)) - r.Price) * 100) / r.Price), 2)).ToString(), CustomerPrice = r.CustomerPrice, CustomerPricePercentage = ((double)System.Math.Round((((r.CustomerPrice - r.Price) * 100) / r.Price), 2)).ToString(), PurchaseUnit = r.PurchaseUnitNumber + " " + PurchaseUnits.ParseEnumToString <PurchaseUnit>(r.PurchaseUnit), //PurchaseUnitNumber = r.PurchaseUnitNumber, DefaultMarginReseller = (double)r.ResellerPrice != 0 ? ((double)(( ((double)System.Math.Round((((r.CustomerPrice - r.Price) * 100) / r.Price), 2)) - ((double)System.Math.Round(((double)((((double)r.ResellerPrice != 0 ? (double)r.ResellerPrice : (r.Price + ((r.CustomerPrice - r.Price) * r.DefaultMarginReseller) / 100)) - r.Price) * 100) / r.Price), 2))) * 100 ) / ((double)(((double)System.Math.Round((((r.CustomerPrice - r.Price) * 100) / r.Price), 2)))) ).ToString() : r.DefaultMarginReseller.ToString() }).OrderBy(m => m.Name).ToList(); return(mic); } catch (Exception ex) { return(new List <Models.GridPriceList>()); } }
public abstract bool Check(string paramLicenseKey, string paramCompany, LicenseTypes license);
public abstract string Generate(int type, string paramCompany, LicenseTypes license);
internal LicenseType(LicenseTypes License) { Type = License; }
public Motorcycle(string i_ModelName, string i_LicenseNumber, EnrgeyVehicles i_EnrgeyType, float i_RemainingEnergy, LicenseTypes i_LicenseType, int i_EngineCapacity, string i_ManufacturerName, float i_CurrentAirPressure) : base(i_ModelName, i_LicenseNumber, i_RemainingEnergy) { m_EnrgeyType = i_EnrgeyType; m_LicenseType = i_LicenseType; m_EngineCapacity = i_EngineCapacity; CreatWheels(2, i_ManufacturerName, i_CurrentAirPressure, 33); if (i_EnrgeyType is ElectricVehicles) { m_EnrgeyType.CreatEnrgey(i_RemainingEnergy, 1.4f); } else { m_EnrgeyType.CreatEnrgey(i_RemainingEnergy, 8f); ((FuelVehicles)m_EnrgeyType).FuelType = FuelTypes.Octan95; } }