public void Initialise(MSSQLConnector conn)
 {
     if (!TableDefinition.Exists(conn))
     {
         ProgramLog.Admin.Log("Permission user table does not exist and will now be created");
         TableDefinition.Create(conn);
     }
 }
 public void Initialise(MSSQLConnector conn)
 {
     if (!TableDefinition.Exists(conn))
     {
         ProgramLog.Admin.Log("Group permissions table does not exist and will now be created");
         TableDefinition.Create(conn);
     }
 }
            public static bool Create(MSSQLConnector conn)
            {
                using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
                {
                    bl.TableCreate(TableName, Columns);

                    return(((IDataConnector)conn).ExecuteNonQuery(bl) > 0);
                }
            }
            public static bool Exists(MSSQLConnector conn)
            {
                using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
                {
                    bl.TableExists(TableName);

                    return(((IDataConnector)conn).Execute(bl));
                }
            }
Example #5
0
        public bool Exists(MSSQLConnector conn)
        {
            using (var sb = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                sb.ProcedureExists(Name);

                return(((IDataConnector)conn).Execute(sb));
            }
        }
            public static bool Exists(MSSQLConnector conn)
            {
                using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
                {
                    bl.TableExists(TableName);

                    return ((IDataConnector)conn).Execute(bl);
                }
            }
            public static bool Create(MSSQLConnector conn)
            {
                using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
                {
                    bl.TableCreate(TableName, Columns);

                    return ((IDataConnector)conn).ExecuteNonQuery(bl) > 0;
                }
            }
Example #8
0
        public bool Create(MSSQLConnector conn)
        {
            using (var sb = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                var proc = PluginContent.GetResource("TDSM.Data.MSSQL.Procedures.Files." + Name + ".sql");

                sb.CommandType = System.Data.CommandType.Text;
                sb.CommandText = proc;

                return(((IDataConnector)conn).Execute(sb));
            }
        }
        public static long Insert(MSSQLConnector conn, long groupId, long permissionId)
        {
            using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                bl.InsertInto(TableDefinition.TableName,
                    new DataParameter(TableDefinition.ColumnNames.GroupId, groupId),
                    new DataParameter(TableDefinition.ColumnNames.PermissionId, permissionId)
                );

                return ((IDataConnector)conn).ExecuteInsert(bl);
            }
        }
        public static long Insert(MSSQLConnector conn, long groupId, long permissionId)
        {
            using (var bl = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                bl.InsertInto(TableDefinition.TableName,
                              new DataParameter(TableDefinition.ColumnNames.GroupId, groupId),
                              new DataParameter(TableDefinition.ColumnNames.PermissionId, permissionId)
                              );

                return(((IDataConnector)conn).ExecuteInsert(bl));
            }
        }
 public static void Init(MSSQLConnector conn)
 {
     foreach (var proc in _procedures)
     {
         #if TESTING
         if (proc.Exists(conn))
             proc.Drop(conn);
         #endif
         if (!proc.Exists(conn))
         {
             ProgramLog.Admin.Log("{0} procedure does not exist and will now be created", proc.Name);
             proc.Create(conn);
         }
     }
     _procedures = null;
 }
Example #12
0
 public static void Init(MSSQLConnector conn)
 {
     foreach (var proc in _procedures)
     {
         #if TESTING
         if (proc.Exists(conn))
         {
             proc.Drop(conn);
         }
         #endif
         if (!proc.Exists(conn))
         {
             ProgramLog.Admin.Log("{0} procedure does not exist and will now be created", proc.Name);
             proc.Create(conn);
         }
     }
     _procedures = null;
 }
        void OnReadConfig(ref HookContext ctx, ref HookArgs.ConfigurationFileLineRead args)
        {
            switch (args.Key)
            {
                case "mssql":
                    if (!Storage.IsAvailable)
                    {
                        MSSQLConnector cn = null;

                        try
                        {
                            cn = new MSSQLConnector(args.Value);
                            cn.Open();
                        }
                        catch (Exception e)
                        {
                            ProgramLog.Error.Log("Exception connecting to MSSQL database: {0}", e);
                            return;
                        }
                        Storage.SetConnector(_connector = cn);
                    }
                    break;
            }
        }
Example #14
0
        void OnReadConfig(ref HookContext ctx, ref HookArgs.ConfigurationFileLineRead args)
        {
            switch (args.Key)
            {
            case "mssql":
                if (!Storage.IsAvailable)
                {
                    MSSQLConnector cn = null;

                    try
                    {
                        cn = new MSSQLConnector(args.Value);
                        cn.Open();
                    }
                    catch (Exception e)
                    {
                        ProgramLog.Error.Log("Exception connecting to MSSQL database: {0}", e);
                        return;
                    }
                    Storage.SetConnector(_connector = cn);
                }
                break;
            }
        }
        public bool Create(MSSQLConnector conn)
        {
            using (var sb = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                var proc = PluginContent.GetResource("TDSM.Data.MSSQL.Procedures.Files." + Name + ".sql");

                sb.CommandType = System.Data.CommandType.Text;
                sb.CommandText = proc;

                return ((IDataConnector)conn).Execute(sb);
            }
        }
        public bool Exists(MSSQLConnector conn)
        {
            using (var sb = new MSSQLQueryBuilder(SqlPermissions.SQLSafeName))
            {
                sb.ProcedureExists(Name);

                return ((IDataConnector)conn).Execute(sb);
            }
        }