Esempio n. 1
0
 private Trello()
 {
     boards = new List <Board>();
     if (File.Exists(@"./datas.json"))
     {
         boards = Json.Deserializer(boards, @"./datas.json");
     }
     boardService = new BoardService();
     rowService   = new RowService();
     taskService  = new TaskService();
     boardService.getBoards().AddRange(boards);
     foreach (var item in boards)
     {
         rowService.getRows().AddRange(item.getRows());
     }
 }
Esempio n. 2
0
        public DBMSQuery(IDatabaseService databaseService, ITableService tableService, IRowService rowService,
                         IDatabaseHub databaseHub)
        {
            Name = nameof(DBMSQuery);

            Field <ListGraphType <DatabaseType> >("databases", "returns all the databases",
                                                  arguments: new QueryArguments(new List <QueryArgument>
            {
            }),
                                                  resolve: context =>
            {
                return(databaseService.GetAllAsync().Result);
            });

            Field <DatabaseType>("create_database", "creates a database",
                                 arguments: new QueryArguments(new List <QueryArgument>
            {
                new QueryArgument <StringGraphType>
                {
                    Name = "name"
                }
            }),
                                 resolve: context =>
            {
                var name     = context.GetArgument <string>("name");
                var database = new DbManager.Models.Database
                {
                    Id   = Guid.NewGuid(),
                    Name = name
                };
                var createdDatabase = databaseService.CreateAsync(database).Result;
                databaseHub.SendMessageAsync("database created");
                return(createdDatabase);
            });

            Field <ListGraphType <TableType> >("tables", "returns database tables",
                                               arguments: new QueryArguments(new List <QueryArgument>
            {
                new QueryArgument <StringGraphType>
                {
                    Name = "databaseId"
                }
            }),
                                               resolve: context =>
            {
                var databaseId = context.GetArgument <Guid?>("databaseId");
                return(tableService.GetAllAsync((Guid)databaseId).Result);
            });

            Field <ListGraphType <RowType> >("rows", "returns table rows",
                                             arguments: new QueryArguments(new List <QueryArgument>
            {
                new QueryArgument <StringGraphType>
                {
                    Name = "tableId"
                }
            }),
                                             resolve: context =>
            {
                var tableId = context.GetArgument <Guid?>("tableId");
                return(rowService.GetAllAsync((Guid)tableId).Result);
            });

            Field <ListGraphType <RowType> >("search", "returns table rows by search keyword",
                                             arguments: new QueryArguments(new List <QueryArgument>
            {
                new QueryArgument <StringGraphType>
                {
                    Name = "tableId"
                },
                new QueryArgument <StringGraphType>
                {
                    Name = "keyword"
                },
                new QueryArgument <StringGraphType>
                {
                    Name = "column"
                }
            }),
                                             resolve: context =>
            {
                var tableId = context.GetArgument <Guid?>("tableId");
                var keyword = context.GetArgument <string>("keyword");
                var column  = context.GetArgument <string>("column");
                return(rowService.SearchByKeywordAsync((Guid)tableId, keyword, column).Result);
            });
        }
Esempio n. 3
0
 public GetRow(IRowService rowService)
 {
     _rowService = rowService;
 }
 public RowController(IRowService rowService)
 {
     this.rowService = rowService;
 }
 /// <summary>
 /// Contructor
 /// </summary>
 /// <param name="invoiceService"></param>
 public InvoiceController(IInvoiceService invoiceService, ITranslationService ts, IUserService userService, IRowService rowService) : base(ts, userService)
 {
     _invoiceService = invoiceService;
     _userService    = userService;
     _rowService     = rowService;
 }
 public TableController(ITableService tableService, IRowService rowService)
 {
     this.tableService = tableService;
     this.rowService   = rowService;
 }