Esempio n. 1
0
        public void PopulateNewWorksheet(OAuth2ClientCredentials clientCredentials, string refreshToken, string spreadsheetTitle, TypesByMarketGroup[] typesByMarketGroups, MarketStatTypesBySolarSystem[] marketStatTypes)
        {
            IUnityContainer unityContainer = UnityContainerFactory.GetUnityContainer();
            IGoogleSpreadsheetAccessor googleSpreadsheetAccessor = unityContainer.Resolve<IGoogleSpreadsheetAccessor>();
            string worksheetTitle = DateTime.Now.ToString();

            IEnumerable<invType> types = typesByMarketGroups.SelectMany(t => t.Types);

            // row for headers + row for each type, plus row for each market group
            int rowCount = types.Count() + typesByMarketGroups.Count() + 1;
            // name column plus buy & sell stats for each system
            int columnCount = 1 + (6 * marketStatTypes.Length);
            ListEntry.Custom[,] listEntries = new ListEntry.Custom[rowCount, columnCount];

            // populate header row
            listEntries[0, 0] = new ListEntry.Custom() { LocalName = "Name" };
            PopulateRow(marketStatTypes, listEntries, 0, null);

            int marketGroupRowIndex = 1;
            foreach (var typesByMarketGroup in typesByMarketGroups)
            {
                listEntries[marketGroupRowIndex, 0] = new ListEntry.Custom() { LocalName = "Name", Value = typesByMarketGroup.MarketGroup.marketGroupName };
                for (int typeCounter = 0; typeCounter < typesByMarketGroup.Types.Count(); typeCounter++)
                {
                    int rowIndex = typeCounter + marketGroupRowIndex + 1;
                    invType invType = typesByMarketGroup.Types.ElementAt(typeCounter);
                    listEntries[rowIndex, 0] = new ListEntry.Custom() { LocalName = "Name", Value = invType.typeName };

                    PopulateRow(marketStatTypes, listEntries, rowIndex, invType);
                }
                marketGroupRowIndex += typesByMarketGroup.Types.Count() + 1;
            }
            googleSpreadsheetAccessor.PopulateNewWorksheet(clientCredentials, refreshToken, spreadsheetTitle, worksheetTitle, listEntries);
        }
        public TypesByMarketGroup[] FindRigsAndSalvagedMaterials()
        {
            Logger.Write("EveAccountancyManager: Finding invTypes for *Rigs and Salvaged Materials invMarketGroups");
            IUnityContainer unityContainer = UnityContainerFactory.GetUnityContainer();
            IInvMarketGroupAccessor invMarketGroupAccessor = unityContainer.Resolve<IInvMarketGroupAccessor>();
            IInvTypeAccessor invTypeAccessor = unityContainer.Resolve<IInvTypeAccessor>();

            invMarketGroup[] marketGroups = invMarketGroupAccessor
                .FindMany(i => i.marketGroupName == "Salvaged Materials" || i.marketGroupName.Contains("Rigs"));

            List<TypesByMarketGroup> typesByMarketGroups = new List<TypesByMarketGroup>();
            foreach (var marketGroup in marketGroups)
            {
                TypesByMarketGroup typesByMarketGroup = new TypesByMarketGroup()
                {
                    MarketGroup = marketGroup,
                };
                typesByMarketGroup.Types.AddRange(invTypeAccessor.FindMany(i => i.marketGroupID == marketGroup.marketGroupID));

                if (typesByMarketGroup.Types.Count > 0)
                {
                    typesByMarketGroups.Add(typesByMarketGroup);
                }
            }

            return typesByMarketGroups.ToArray();
        }
        public void SpreadsheetEngine_PopulateNewWorksheet()
        {
            SpreadsheetEngine spreadsheetEngine = new SpreadsheetEngine();

            TypesByMarketGroup typesByMarketGroup = new TypesByMarketGroup()
            {
                MarketGroup = new invMarketGroup(),
            };
            typesByMarketGroup.Types.Add(new invType()
            {
                typeID = 1
            });

            MarketStatTypesBySolarSystem marketStatType = new MarketStatTypesBySolarSystem()
            {
                MapSolarSystem = new mapSolarSystem(),
            };

            spreadsheetEngine.PopulateNewWorksheet(new OAuth2ClientCredentials(),
                string.Empty, string.Empty, new TypesByMarketGroup[] { typesByMarketGroup }, new MarketStatTypesBySolarSystem[] { marketStatType });
        }
        public void PopulateNewWorksheet(OAuth2ClientCredentials clientCredentials, string refreshToken, string spreadsheetTitle, TypesByMarketGroup[] typesByMarketGroup, MarketStatTypesBySolarSystem[] marketStatTypes)
        {
            Logger.Write(string.Format("EveAccountancyManager: Writing to spreadsheet {0}", spreadsheetTitle));
            IUnityContainer unityContainer = UnityContainerFactory.GetUnityContainer();
            ISpreadsheetEngine spreadsheetEngine = unityContainer.Resolve<ISpreadsheetEngine>();

            spreadsheetEngine.PopulateNewWorksheet(clientCredentials, refreshToken, spreadsheetTitle, typesByMarketGroup, marketStatTypes);
        }
 public void PopulateNewWorksheet(OAuth2ClientCredentials clientCredentials, string refreshToken, string spreadsheetTitle, TypesByMarketGroup[] typesByMarketGroup, MarketStatTypesBySolarSystem[] marketStatTypes)
 {
 }