public void Sync() { var tenant = TenantManager.GetTenants(false).OrderByDescending(t => t.Version).FirstOrDefault(); if (tenant != null) { using var wcfClient = new TariffSyncClient(); var quotaService = DbQuotaService; var oldtariffs = quotaService.GetTenantQuotas().ToDictionary(t => t.Id); // save new foreach (var tariff in wcfClient.GetTariffs(tenant.Version, CoreSettings.GetKey(tenant.TenantId))) { quotaService.SaveTenantQuota(tariff); oldtariffs.Remove(tariff.Id); } // remove old foreach (var tariff in oldtariffs.Values) { tariff.Visible = false; quotaService.SaveTenantQuota(tariff); } } }
public void SendInstallInfo(UserInfo user) { try { StudioNotifyService.SendRegData(user); var url = Configuration["web:install-url"]; if (string.IsNullOrEmpty(url)) { return; } var tenant = TenantManager.GetCurrentTenant(); var q = new MailQuery { Email = user.Email, Id = CoreSettings.GetKey(tenant.TenantId), Alias = tenant.GetTenantDomain(CoreSettings), }; var index = url.IndexOf("?v=", StringComparison.InvariantCultureIgnoreCase); if (0 < index) { q.Version = url.Substring(index + 3) + Environment.OSVersion; url = url.Substring(0, index); } using var webClient = new WebClient(); var values = new NameValueCollection { { "query", Signature.Create(q, "4be71393-0c90-41bf-b641-a8d9523fba5c") } }; webClient.UploadValues(url, values); } catch (Exception error) { Log.Error(error); } }
protected override bool TryPrepareRow(bool dump, DbConnection connection, ColumnMapper columnMapper, TableInfo table, DataRowInfo row, out Dictionary <string, object> preparedRow) { if (table.Name == "tenants_tenants" && string.IsNullOrEmpty(Convert.ToString(row["payment_id"]))) { var oldTenantID = Convert.ToInt32(row["id"]); columnMapper.SetMapping("tenants_tenants", "payment_id", row["payment_id"], coreSettings.GetKey(oldTenantID)); } return(base.TryPrepareRow(dump, connection, columnMapper, table, row, out preparedRow)); }
private string GetPortalId(int tenant) { return(CoreSettings.GetKey(tenant)); }