Ejemplo n.º 1
0
 public AdminModule(IConfiguration config, IGumroadApi gumroad, RootDatabase db, ResponsiveService responsive)
 {
     _config     = config;
     _gumroad    = gumroad;
     _db         = db;
     _responsive = responsive;
 }
Ejemplo n.º 2
0
        public ReactionWatcherService(
            ILogger <ReactionWatcherService> logger,
            DiscordSocketClient discord,
            LinkingService linking,
            RootDatabase db)
        {
            _logger         = logger;
            _discord        = discord;
            _linking        = linking;
            _db             = db;
            _syncedProducts = new ConcurrentDictionary <ulong, RexoProduct>();

            _discord.ReactionAdded += OnReactionAddedAsync;
        }
Ejemplo n.º 3
0
        private bool CheckReferenceData(long tableId, string tableName, string schema, List <Column> columns)
        {
            // If table is deference data
            // For check reference data
            bool existAddOrUpdate = false;

            if (ExtendProperties.Any(x =>
                                     x.major_id == tableId && x.name.Equals("ReferenceData", StringComparison.OrdinalIgnoreCase) &&
                                     x.value.Equals("Enum", StringComparison.OrdinalIgnoreCase)))
            {
                var data = SqlService.LoadData(CurrentSqlConnection, tableName, $"SELECT * FROM [{schema}].[{tableName}]");
                if (data.Rows.Count > 0)
                {
                    var tableElement = new XElement("Table");
                    var dataElement  = new XElement("Data");
                    tableElement.SetAttributeValue("Name", tableName);
                    if (schema.ToLower() != "dbo")
                    {
                        tableElement.SetAttributeValue("Schema", schema);
                    }

                    foreach (var rowData in data.Rows.Cast <DataRow>())
                    {
                        var rowElement = new XElement("Row");
                        foreach (var column in data.Columns.Cast <DataColumn>().OrderBy(x => x.ColumnName))
                        {
                            if (column.ColumnName.Equals("ID", StringComparison.OrdinalIgnoreCase) ||
                                rowData[column.ColumnName] == System.DBNull.Value)
                            {
                                continue;
                            }
                            existAddOrUpdate = true;
                            rowElement.SetAttributeValue(XmlConvert.EncodeName(column.ColumnName) ?? column.ColumnName, rowData[column.ColumnName].ToString());
                        }
                        existAddOrUpdate = true;
                        dataElement.Add(rowElement);
                    }

                    var columnType = GetColumnTypes(columns);
                    dataElement.AddFirst(columnType);
                    tableElement.Add(dataElement);
                    RootDatabase.Add(tableElement);
                }
            }
            return(existAddOrUpdate);
        }
Ejemplo n.º 4
0
        private void SaveChanges(string output)
        {
            if (UpdateTables.HasElements)
            {
                RootDatabase.Add(UpdateTables);
            }
            if (AddTables.HasElements)
            {
                RootDatabase.Add(AddTables);
            }
            if (RemoveTables.HasElements)
            {
                RootDatabase.Add(RemoveTables);
            }

            Doc.Add(RootDatabase);
            Doc.Save(output);
        }
Ejemplo n.º 5
0
 public GuildConfigModule(RootDatabase db)
 {
     _db = db;
 }
Ejemplo n.º 6
0
 public UserConfigModule(RootDatabase db)
 {
     _db = db;
 }