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

OWS Management Work #147

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -638,5 +638,49 @@ public async Task UpdateAbilityOnCharacter(Guid customerGUID, string abilityName
await Connection.ExecuteAsync(MSSQLQueries.UpdateAbilityOnCharacter, parameters);
}
}

public async Task<IEnumerable<Characters>> GetCharacters(Guid customerGuid)
{
IEnumerable<Characters> outputObject = null;

using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);

outputObject = await Connection.QueryAsync<Characters>(GenericQueries.GetCharacters, p);
}

return outputObject;
}

public async Task<SuccessAndErrorMessage> RemoveCharacter(Guid customerGuid, string characterName)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);
p.Add("@CharacterName", characterName);

await Connection.ExecuteAsync(GenericQueries.RemoveCharacter, p, commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,137 @@ await Connection.ExecuteAsync("AddOrUpdateMapZone",
return output;
}
}

public async Task<IEnumerable<WorldServers>> GetWorldServers(Guid customerGuid)
{
IEnumerable<WorldServers> outputObject = null;

using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);

outputObject = await Connection.QueryAsync<WorldServers>(GenericQueries.GetWorldServers, p);
}

return outputObject;
}

public async Task<SuccessAndErrorMessage> RemoveWorldServer(Guid customerGuid, int worldserverid)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);
p.Add("@WorldServerID", worldserverid);

await Connection.ExecuteAsync(GenericQueries.RemoveWorldServer, p, commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}

public async Task<IEnumerable<Maps>> GetZones(Guid customerGuid)
{
IEnumerable<Maps> outputObject = null;

using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);

outputObject = await Connection.QueryAsync<Maps>(GenericQueries.GetZones, p);
}

return outputObject;
}

public async Task<SuccessAndErrorMessage> RemoveZone(Guid customerGuid, int mapid)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);
p.Add("@MapID", mapid);

await Connection.ExecuteAsync(GenericQueries.RemoveZone, p, commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}

public async Task<IEnumerable<MapInstances>> GetMapInstances(Guid customerGuid)
{
IEnumerable<MapInstances> outputObject = null;

using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);

outputObject = await Connection.QueryAsync<MapInstances>(GenericQueries.GetMapInstances, p);
}

return outputObject;
}

public async Task<SuccessAndErrorMessage> RemoveMapInstances(Guid customerGuid, int mapinstanceid)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);
p.Add("@MapInstanceID", mapinstanceid);

await Connection.ExecuteAsync(GenericQueries.RemoveMapInstances, p, commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}
}
}
31 changes: 31 additions & 0 deletions src/OWSData/Repositories/Implementations/MSSQL/UsersRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,5 +447,36 @@ await Connection.ExecuteAsync(GenericQueries.UpdateUser,
return outputObject;
}
}

public async Task<SuccessAndErrorMessage> RemoveUser(Guid customerGuid, Guid userGuid, string email)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@UserGUID", userGuid);
p.Add("@Email", email);

await Connection.ExecuteAsync(GenericQueries.RemoveUser,
p,
commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -591,5 +591,49 @@ public async Task UpdateAbilityOnCharacter(Guid customerGUID, string abilityName
await Connection.ExecuteAsync(MySQLQueries.UpdateAbilityOnCharacter, parameters);
}
}

public async Task<IEnumerable<Characters>> GetCharacters(Guid customerGuid)
{
IEnumerable<Characters> outputObject = null;

using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);

outputObject = await Connection.QueryAsync<Characters>(GenericQueries.GetCharacters, p);
}

return outputObject;
}

public async Task<SuccessAndErrorMessage> RemoveCharacter(Guid customerGuid, string characterName)
{
SuccessAndErrorMessage outputObject = new SuccessAndErrorMessage();

try
{
using (Connection)
{
var p = new DynamicParameters();
p.Add("@CustomerGUID", customerGuid);
p.Add("@CharacterName", characterName);

await Connection.ExecuteAsync(GenericQueries.RemoveCharacter, p, commandType: CommandType.Text);
}

outputObject.Success = true;
outputObject.ErrorMessage = "";

return outputObject;
}
catch (Exception ex)
{
outputObject.Success = false;
outputObject.ErrorMessage = ex.Message;

return outputObject;
}
}
}
}
Loading