Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #167

Merged
merged 2 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void AddUserToRole(string userId, string roleId)
{
using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
db.Execute($"INSERT INTO public.aspnetuserroles ([userid] ,[roleid]) VALUES (@userId, @roleId)", new { userId = userId, roleId = roleId });
db.Execute($"INSERT INTO public.aspnetuserroles (\"userid\" ,\"roleid\") VALUES (@userId, @roleId)", new { userId = userId, roleId = roleId });
}
}
else
Expand All @@ -161,8 +161,8 @@ public void InitUserExtInfo(string userId)
{
using (IDbConnection db = new NpgsqlConnection(DataConfig.CoreConnectionString))
{
db.Execute($"INSERT INTO public.aspnetusersext ([userid] ,[createdate] ,[lastactivitydate]) VALUES (@userId,@dateTimeNow,@dateTimeNow)", new { userId = userId, dateTimeNow = DateTime.UtcNow });
db.Execute($"UPDATE public.aspnetusers SET emailconfirmed = 1 WHERE id = @userId", new { userId = userId });
db.Execute($"INSERT INTO public.aspnetusersext (\"userid\" ,\"createdate\" ,\"lastactivitydate\") VALUES (@userId,@dateTimeNow,@dateTimeNow)", new { userId = userId, dateTimeNow = DateTime.UtcNow });
db.Execute($"UPDATE public.aspnetusers SET emailconfirmed = true WHERE id = @userId", new { userId = userId });
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ public string GetQuery<TEntity>(TEntity entity)
if (((IEntity)entity).IdType == 0)
{
ignoredProperties.Add(((IEntity)entity).IdName);
returnId = _sqlConfiguration.InsertGetReturnIdCommand;

if (Config.DataConfig.DatabaseType == Config.DatabaseTypes.Postgres)
{
returnId = $" RETURNING {((IEntity)entity).IdName.ToLower()}";
}
else
returnId = _sqlConfiguration.InsertGetReturnIdCommand;
}

var columns = entity.GetColumns(_sqlConfiguration, ignoreProperties: ignoredProperties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public PostgreSqlConfiguration()
SchemaName = "public";
TableColumnStartNotation = "\"";
TableColumnEndNotation = "\"";
InsertGetReturnIdCommand =
"; SELECT lastval();"; // For Postgresql INSERT INTO persons (lastname,firstname) VALUES ('Smith', 'John') RETURNING id; https://stackoverflow.com/questions/2944297/postgresql-function-for-last-inserted-id/2944481
//InsertGetReturnIdCommand =
// "; SELECT lastval();"; // For Postgresql INSERT INTO persons (lastname,firstname) VALUES ('Smith', 'John') RETURNING id; https://stackoverflow.com/questions/2944297/postgresql-function-for-last-inserted-id/2944481
InsertGetReturnIdCommand = "";
QueryPrefix = DataConfig.QueryPrefix;
#region Common Queries

Expand Down Expand Up @@ -391,7 +392,7 @@ SELECT COUNT(*) FROM %SCHEMA%.%MESSAGESTABLE% m
UpdateRoleQuery = "UPDATE %SCHEMA%.%TABLENAME% %SETVALUES% WHERE Id = %ID%";
SelectRoleByNameQuery = "SELECT * FROM %SCHEMA%.%TABLENAME% WHERE Name = %NAME%";
SelectRoleByIdQuery = "SELECT * FROM %SCHEMA%.%TABLENAME% WHERE Id = %ID%";
InsertUserQuery = "INSERT INTO %SCHEMA%.%TABLENAME% %COLUMNS% OUTPUT INSERTED.Id VALUES(%VALUES%)";
InsertUserQuery = "INSERT INTO %SCHEMA%.%TABLENAME% %COLUMNS% VALUES(%VALUES%) RETURNING id;";
DeleteUserQuery = "DELETE FROM %SCHEMA%.%TABLENAME% WHERE Id = %ID%";
UpdateUserQuery = "UPDATE %SCHEMA%.%TABLENAME% %SETVALUES% WHERE Id = %ID%";
SelectUserByUserNameQuery =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@
const amount = slider == 1 ? val : $("#amount").val();

if (amount && amount > 10) {
const packs = amount / 10;
const packs = (amount / 10) - 1; // First 10 users are free.

$.ajax({
url: resgrid.absoluteBaseUrl + '/User/Subscription/GetStripeSession?id=' + id + '&count=' + packs,
Expand Down Expand Up @@ -652,7 +652,7 @@
];

let finalCost = 0.0;
let remainingUsers = totalNumUsers / 10;
let remainingUsers = (totalNumUsers / 10) - 1; // First 10 users are free.
let pricingTiers = isMonthly ? pricingTiersMonthly : pricingTiersYearly;

for (let i = 0; i < pricingTiers.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<script>
var unitId = '@Model.Unit.UnitId';
var osmKey = '@Model.OSMKey';
var osmTileUrl = '@Resgrid.Config.MappingConfig.GetWebsiteOSMUrl()';
var centerLat = '@Model.CenterLat';
var centerLon = '@Model.CenterLon';
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,10 @@ var resgrid;
var viewevents;
(function (viewevents) {
$(document).ready(function () {




//var mapOptions = {
// center: new google.maps.LatLng(43, 16),
// zoom: 11,
// mapTypeId: google.maps.MapTypeId.ROADMAP
//};
//map = new google.maps.Map(document.getElementById('eventsMap'), mapOptions);

viewevents.markers = [];
viewevents.map = L.map('eventsMap').setView([centerLat, centerLon], 13);
L.tileLayer('https://api.maptiler.com/maps/streets/{z}/{x}/{y}.png?key=' + osmKey, {

L.tileLayer(osmTileUrl, {
attribution: ''
}).addTo(viewevents.map);

Expand Down
Loading