private void LicenseDetail_Load(object sender, System.EventArgs e) { LicenseDetail licenseDetail = LicenseDAL.GetLicenseDetail(); if (licenseDetail == null) { MessageBox.Show("No Valid Lincense found"); this.Close(); return; } txt_createdAt.Text = licenseDetail.CreateDateTime.ToString(); txt_licenseKey.Text = licenseDetail.UID; txt_validUpto.Text = licenseDetail.ValidUpto.ToString(); }
//public IAsyncEnumerable<CustomerCatalogGroup> GetProductsAsync() => // _unitOfWork.GetRepositoryAsync<CustomerCatalogGroup>().GetListAsync(); public bool TryGetLicense(string id, out LicenseDetail license) { var catalog = _unitOfWork.GetRepository <CustomerCatalogGroup>().Single(predicate: x => x.CustomerCatalogGroupId == id, include: x => x. Include(c => c.Customer).ThenInclude(con => con.BusinessContact).ThenInclude(per => per.ContactPerson) .Include(r => r.RenewedDetail)); if (catalog == null) { license = null; return(false); } license = new LicenseDetail(); license.CustomerCatalogGroupId = catalog.CustomerCatalogGroupId; license.NumberofSystem = catalog.NumberofSystem; if (catalog.RenewedDetail != null) { license.ExpiryDate = catalog.RenewedDetail.ExpiryDate; } if (catalog.Customer != null) { if (catalog.Customer.BusinessContact != null) { license.BusinessName = catalog.Customer.BusinessContact.BusinessName; license.MobileNo = catalog.Customer.MobileNo; license.EmailId = catalog.Customer.CustomerEmailId; if (catalog.Customer.BusinessContact.ContactPerson != null) { license.ContactPersonName = catalog.Customer.BusinessContact.ContactPerson.FirstName; } } } license.ActiveSystemCount = _unitOfWork.GetRepository <LicensedHardware>().GetList(x => x.CustomerCatalogGroupId == catalog.Id).Count; return(license != null); }