public void DeleteLicenseSetId(int licenseSetId) { using (ScutexServiceEntities db1 = new ScutexServiceEntities()) { var keys = from lk in db1.LicenseSets where lk.LicenseSetId == licenseSetId select lk; foreach (var i in keys) { db1.LicenseSets.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 DeleteLicenseKeyByKey(string licenseKey) { using (ScutexServiceEntities db1 = new ScutexServiceEntities()) { var keys = from lk in db1.LicenseKeys where lk.Key == licenseKey select lk; foreach (var i in keys) { db1.LicenseKeys.DeleteObject(i); } 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 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(); } }
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 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(); } }
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()); }
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)); }