public void SaveActivationLog(Model.ActivationLog activationLog)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				ActivationLog al = new ActivationLog();
				al.LicenseKey = activationLog.LicenseKey;
				al.ActivationResult = (int)activationLog.ActivationResult;
				al.IPAddress = activationLog.IpAddress;
				al.Timestamp = activationLog.Timestamp;

				db1.AddToActivationLogs(al);
				db1.SaveChanges();
			}
		}
        public void DeleteLicenseKeyByLicenseSetId(int licenseSetId)
        {
            using (ScutexServiceEntities db1 = new ScutexServiceEntities())
            {
                var keys = from lk in db1.LicenseKeys
                                     where lk.LicenseSetId == licenseSetId
                                     select lk;

                foreach (var i in keys)
                    db1.LicenseKeys.DeleteObject(i);

                db1.SaveChanges();
            }
        }
        public void DeleteLicenseActivationsByKeyId(int licenseKeyId)
        {
            using (ScutexServiceEntities db1 = new ScutexServiceEntities())
            {
                var licenseActivations = from la in db1.LicenseActivations
                                                                 where la.LicenseKeyId == licenseKeyId
                                                                 select la;

                foreach (var i in licenseActivations)
                    db1.LicenseActivations.DeleteObject(i);

                db1.SaveChanges();
            }
        }
		public void DeleteActivationLogByKey(string key)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				var logs = from l in db1.ActivationLogs
									 where l.LicenseKey == key
									 select l;

				foreach (var l in logs)
				{
					db1.ActivationLogs.DeleteObject(l);
				}

				db1.SaveChanges();
			}
		}
Example #5
0
		public MasterServiceData SetMasterServiceData(MasterServiceData data)
		{
			if (GetMasterServiceData() != null)
				return null;

			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				Master m = new Master();
				m.ServiceId = data.ServiceId;
				m.ClientInboundKey = data.ClientInboundKey;
				m.ClientOutboundKey = data.ClientOutboundKey;
				m.ManagementInboundKey = data.ManagementInboundKey;
				m.ManagementOutboundKey = data.ManagementOutboundKey;
				m.Token = data.Token;

				db1.AddToMasters(m);
				db1.SaveChanges();
			}

			return GetMasterServiceData();
		}
		private void InsertServiceLicenseSet(ServiceLicenseSet licenseSet)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				LicenseSet ls = new LicenseSet();
				ls.LicenseSetId = licenseSet.LicenseSetId;
				ls.LicenseId = licenseSet.LicenseId;
				ls.Name = licenseSet.LicenseSetName;
				ls.LicenseType = (int)licenseSet.LicenseType;
				ls.MaxUsers = licenseSet.MaxUsers;

				db1.AddToLicenseSets(ls);
				db1.SaveChanges();
			}
		}
		private void UpdateServiceLicenseSet(ServiceLicenseSet licenseSet)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				var licSet = (from ls in db1.LicenseSets
											where ls.LicenseSetId == licenseSet.LicenseSetId
											select ls).First();

				licSet.LicenseSetId = licenseSet.LicenseSetId;
				licSet.LicenseId = licenseSet.LicenseId;
				licSet.Name = licenseSet.LicenseSetName;
				licSet.LicenseType = (int)licenseSet.LicenseType;
				licSet.MaxUsers = licenseSet.MaxUsers;

				db1.SaveChanges();
			}
		}
		private void DeleteServiceProductById(int productId)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				var prods = from prod in db1.Licenses
								where prod.LicenseId == productId
								select prod;

				foreach (var p in prods)
					db1.Licenses.DeleteObject(p);

				db1.SaveChanges();
			}
		}
		private void InsertServiceProduct(ServiceProduct product)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				License l = new License();
				l.LicenseId = product.LicenseId;
				l.Name = product.LicenseName;

				db1.AddToLicenses(l);
				db1.SaveChanges();
			}
		}
		private void UpdateServiceProduct(ServiceProduct product)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				var lic = (from l in db1.Licenses
									 where l.LicenseId == product.LicenseId
									 select l).First();

				lic.Name = product.LicenseName;

				db1.SaveChanges();
			}
		}
		public ServiceProductsRepository(ScutexServiceEntities db)
		{
			this.db = db;
		}
Example #12
0
		public Model.LicenseActivation InsertLicenseActivation(Model.LicenseActivation licenseActivation)
		{
			int newId;

			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				LicenseActivation la = new LicenseActivation();

				la.LicenseKeyId = licenseActivation.LicenseKeyId;
				la.ActivationToken = licenseActivation.ActivationToken;
				la.ActivatedOn = licenseActivation.ActivatedOn;
				la.OriginalToken = licenseActivation.OriginalToken;
				la.ActivationStatus = (int)licenseActivation.ActivationStatus;
				la.ActivationStatusUpdatedOn = licenseActivation.ActivationStatusUpdatedOn;
				la.HardwareHash = licenseActivation.HardwareHash;

				db1.AddToLicenseActivations(la);
				db1.SaveChanges();

				newId = la.LicenseActivationId;
			}

			return GetLicenseActivationById(newId);
		}
Example #13
0
		public CommonRepository(ScutexServiceEntities db)
		{
			this.db = db;
		}
		public ActivationLogRepoistory(ScutexServiceEntities db)
		{
			this.db = db;
		}
		private void UpdateServiceLicenseKey(ServiceLicenseKey serviceLicenseKey)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				var licKey = (from lk in db1.LicenseKeys
											where lk.Key == serviceLicenseKey.Key
											select lk).First();

				licKey.Key = serviceLicenseKey.Key;
				licKey.CreatedOn = serviceLicenseKey.CreatedOn;
				licKey.ActivationCount = serviceLicenseKey.ActivationCount;
				licKey.Deactivated = serviceLicenseKey.Deactivated;
				licKey.DeactivatedOn = serviceLicenseKey.DeactivatedOn;
				licKey.DeactivatedReason = serviceLicenseKey.DeactivatedReason;
				licKey.LicenseSetId = serviceLicenseKey.LicenseSetId;

				db1.SaveChanges();
			}
		}
		private void InsertServiceLicenseKey(ServiceLicenseKey serviceLicenseKey)
		{
			using (ScutexServiceEntities db1 = new ScutexServiceEntities())
			{
				LicenseKey licKey = new LicenseKey();
				licKey.Key = serviceLicenseKey.Key;
				licKey.ActivationCount = serviceLicenseKey.ActivationCount;
				licKey.Deactivated = serviceLicenseKey.Deactivated;
				licKey.DeactivatedOn = serviceLicenseKey.DeactivatedOn;
				licKey.DeactivatedReason = serviceLicenseKey.DeactivatedReason;
				licKey.LicenseSetId = serviceLicenseKey.LicenseSetId;
				licKey.CreatedOn = serviceLicenseKey.CreatedOn;

				db1.AddToLicenseKeys(licKey);
				db1.SaveChanges();
			}
		}
Example #17
0
		public ClientRepository(ScutexServiceEntities db)
		{
			this.db = db;
		}