Beispiel #1
0
 public ImpUkurSasaran()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
 public ImpAdministrator()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
 public ImpLoginClient()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
 public ImpChangePassword()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
Beispiel #5
0
        private async Task <int> ManipulateClientAsync(Client client, string script, bool insert)
        {
            using (var dbContext = ConnectionDatabase.Get(_configuration))
            {
                using (var transaction = dbContext.BeginTransaction())
                {
                    int affectedRows, clientId = 0;

                    if (insert)
                    {
                        clientId = await dbContext.QueryFirstOrDefaultAsync <int>($"{script} select SCOPE_IDENTITY();", client, transaction);

                        if (clientId != 0)
                        {
                            affectedRows = 1;
                        }
                        else
                        {
                            return(clientId);
                        }
                    }
                    else
                    {
                        affectedRows = await dbContext.ExecuteAsync(script, client, transaction);

                        clientId = client.Id;
                    }

                    if (affectedRows == 0)
                    {
                        return(affectedRows);
                    }
                    if (client.AllowedScopes.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientScopes values (@Scope,@ClientId);", client.AllowedScopes.Select(x => new
                        {
                            x.Scope,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback(); return(affectedRows);
                    }
                    if (client.AllowedGrantTypes.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientGrantTypes values (@GrantType,@ClientId);", client.AllowedGrantTypes.Select(x => new
                        {
                            x.GrantType,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback(); return(affectedRows);
                    }
                    if (client.RedirectUris.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientRedirectUris values (@RedirectUri,@ClientId);", client.RedirectUris.Select(x => new
                        {
                            x.RedirectUri,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback(); return(affectedRows);
                    }
                    if (client.AllowedCorsOrigins.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientCorsOrigins values (@Origin,@ClientId);", client.AllowedCorsOrigins.Select(x => new
                        {
                            x.Origin,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback(); return(affectedRows);
                    }
                    if (client.IdentityProviderRestrictions.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientIdPRestrictions values (@Provider,@ClientId);", client.IdentityProviderRestrictions.Select(x => new
                        {
                            x.Provider,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback(); return(affectedRows);
                    }
                    if (client.PostLogoutRedirectUris.Any())
                    {
                        affectedRows = await dbContext.ExecuteAsync("insert into ClientPostLogoutRedirectUris values (@PostLogoutRedirectUri,@ClientId);", client.PostLogoutRedirectUris.Select(x => new
                        {
                            x.PostLogoutRedirectUri,
                            ClientId = clientId
                        }), transaction);
                    }

                    if (affectedRows == 0)
                    {
                        transaction.Rollback();
                    }
                    else
                    {
                        transaction.Commit();
                    }

                    return(insert ? clientId : affectedRows);
                }
            }
        }
Beispiel #6
0
 public ImpLoginPegawai()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
 public ImpValidationReport()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
Beispiel #8
0
 public ImpPenilai()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
 public ImpCapaianHarian()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
Beispiel #10
0
 public ImpValidationPeriode()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
Beispiel #11
0
 private void ClickMethodTestConection()
 {
     MessageBox.Show(ConnectionDatabase.TestConnectDb(StringConnect()) ? "True" : "False");
 }
Beispiel #12
0
 public ImpRealisasi()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }
Beispiel #13
0
 public ImpJenisKegiatan()
 {
     connect = new ConnectionDatabase();
     connect.getConn();
 }