public async Task <string> InsertSignup([FromBody] Signup signup)
        {
            try
            {
                List <object> objList = new List <object>
                {
                    DateTime.Now.ToLongDateString(),
                              signup.user.id,
                              signup.user.name,
                    "'" + signup.user.discordId,
                              signup.user.location,
                              @$ "https://webapp.imperialesportsleague.co.uk/user/{signup.user.id}",
                              signup.user.referral,
                              signup.feedback
                };
                objList.AddRange(signup.socialAccounts.Where(x => x.active && x.type == "twitter").Select(x => x.platform_name).Take(17));

                int rowNumber = SpreadsheetService.Instance().GetNextAvailableRow();
                await SpreadsheetService.Instance().MakeRequest($"Player Data!A:Y{rowNumber}", objList).ConfigureAwait(false);

                return("200");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
        public SpreadsheetManagementService(ISqlConnectionProvider connectionProvider)
        {
            _connectionProvider = connectionProvider;
            var exporter = new DefaultSpreadsheetExporter();
            var importer = new DefaultSpreadsheetImporter(connectionProvider, "InsertIntoFees2SP");
            var template = new TestTemplate();

            _service = new SpreadsheetService(exporter, importer, new AlwaysTrueSpreadsheetValidator(), template);
        }
Exemple #3
0
        public void FindGuidTest()
        {
            Guid                 guid     = Guid.NewGuid();
            Workbook             workbook = new Workbook();
            ISpreadsheetTemplate template = new FindGuidTestTemplateStub();

            workbook.Worksheets[template.DataSheetName][template.GuidCell].Value = guid.ToString();
            SpreadsheetService service = new SpreadsheetService(null, null, null, template);
            var g = service.FindGuid(workbook);

            Assert.AreEqual(guid, g);
        }
    void Start()
    {
        service = new SpreadsheetService(SpreadsheetInfo.CREDENTIALS_PATH, SpreadsheetInfo.SPREADSHEET_ID);

        service.AddValues(new List <object>()
        {
            "elemento 1", "elemento 2"
        });

        service.UpdateCell("A2", "atualizado");

        IList <IList <object> > values = service.GetValues("A2:B2");

        foreach (var row in values)
        {
            foreach (var col in row)
            {
                Debug.Log(col);
            }
        }
    }
Exemple #5
0
        public static async Task Main(string[] args)
        {
            var team = await SpreadsheetService.GetTeam();

            var gatewayAssignment = GatewayAssignmentLogic.AssignGateways(team);
            await MainSheetService.WriteGatewayAssignments(gatewayAssignment);

            Console.WriteLine("Gateway assignments written");

            var orbLogic          = new OrbAssignmentLogic(gatewayAssignment);
            var orbAssignmentList = orbLogic.AssignPlayers(team);
            await MainSheetService.WriteOrbAssignments(orbAssignmentList);

            Console.WriteLine("Orb assignments written");

            await MainSheetService.WriteOrbMacros(orbAssignmentList);

            Console.WriteLine("Macros written");

            var teleportAssignments = TeleportAssignmentLogic.GetTeleportAssignments(orbAssignmentList).ToList();
            await MainSheetService.WriteTeleportAssignments(teleportAssignments);

            Console.WriteLine("Teleport assignments written");

            var statueAssignments = StatueAssignmentLogic.GetStatueAssignment(orbAssignmentList).ToList();
            await MainSheetService.WriteStatueAssignments(statueAssignments);

            Console.WriteLine("Statue assignments written");

            var interruptAssignments = InterruptAssignmentLogic.AssignInterrupts(orbAssignmentList);
            await MainSheetService.WriteInterruptAssignments(interruptAssignments);

            Console.WriteLine("Interrupt assignments written");
            await MainSheetService.WriteTendrilAssignments(interruptAssignments);

            Console.WriteLine("Tendril assignments written");

            var burstingBoilAssignments = BurstingBoilAssignmentLogic.AssignBurstingBoilAreas(orbAssignmentList);
            await MainSheetService.WriteBurstingBoilAssignments(burstingBoilAssignments);

            Console.WriteLine("Bursting boil assignments written");

            var p3Assignments = PhaseThreeAreaAssignmentLogic.AssignPhaseThreeAreas(orbAssignmentList);
            await MainSheetService.WriteP3Assignments(p3Assignments);

            Console.WriteLine("Phase three assignments written");

            var personalAssignmentInput = new PersonalAssignmentInput
            {
                BurstingBoils   = BurstingBoilAssignmentLogic.ListAssignments(burstingBoilAssignments),
                Gateways        = GatewayAssignmentLogic.ListAssignments(gatewayAssignment),
                Interrupts      = InterruptAssignmentLogic.ListAssignments(interruptAssignments),
                Tendrils        = InterruptAssignmentLogic.ListTendrilAssignments(interruptAssignments).ToList(),
                Orbs            = orbAssignmentList,
                PhaseThreeAreas = PhaseThreeAreaAssignmentLogic.ListAssignments(p3Assignments),
                Statues         = statueAssignments,
                Teleports       = teleportAssignments
            };

            var personalAssignments = PersonalAssignmentLogic.ListAssignments(personalAssignmentInput);
            await PersonalAssignmentService.WritePersonalAssignments(personalAssignments);

            Console.WriteLine("Personal assignments written");

            Console.ReadKey();
        }