Пример #1
0
        //public static bool OwnerHasContractsInProgress(int ownerID)
        //{
        //    EMMADataSet.ContractsDataTable table = new EMMADataSet.ContractsDataTable();
        //    contractsTableAdapter.FillByStatus(table, ownerID.ToString(), 1);
        //    return table.Count > 0;
        //}
        public static EMMADataSet.IDTableDataTable GetInvolvedStationIDs(List<long> ownerIDs, 
            ContractStationType type)
        {
            StringBuilder ownerIDString = new StringBuilder("");
            foreach (int ownerID in ownerIDs)
            {
                if (ownerIDString.Length != 0) { ownerIDString.Append(","); }
                ownerIDString.Append(ownerID);
            }

            EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
            lock (contractsTableAdapter)
            {
                if (type == ContractStationType.Pickup)
                {
                    IDTableAdapter.FillStationIDsByContractPickup(table, ownerIDString.ToString());
                }
                else
                {
                    IDTableAdapter.FillStationIDsByContractDest(table, ownerIDString.ToString());
                }
            }
            return table;
        }
Пример #2
0
        /// <summary>
        /// Get a datatable containing the IDs of items that are involved in transactions that meet
        /// the specifeid criteria.
        /// </summary>
        /// <param name="accessParams"></param>
        /// <returns></returns>
        public static EMMADataSet.IDTableDataTable GetInvolvedItemIDs(List<FinanceAccessParams> accessParams,
            int minVolume, DateTime minDate, DateTime maxDate, int minBuy, int minSell, List<long> buyStations,
            List<long> sellStations)
        {
            EMMADataSet.IDTableDataTable retVal = new EMMADataSet.IDTableDataTable();
            EMMADataSet.TransactionsDataTable table = GetTransData(accessParams, null, null, null,
                minDate, maxDate, "");
            Dictionary<int, long> qTotalBuy = new Dictionary<int, long>();
            Dictionary<int, long> qTotalSell = new Dictionary<int, long>();
            List<int> allItems = new List<int>();

            foreach (EMMADataSet.TransactionsRow trans in table)
            {
                int itemID = trans.ItemID;
                if (!allItems.Contains(itemID)) { allItems.Add(itemID); }
                long stationID = trans.StationID;
                bool buyTrans = false;
                bool sellTrans = false;
                // Determine if this transaction is buy, sell or both for the characters passed in
                foreach (FinanceAccessParams accessDetails in accessParams)
                {
                    if (accessDetails.OwnerID == trans.BuyerID || accessDetails.OwnerID == trans.BuyerCharacterID)
                    {
                        buyTrans = true;
                    }
                    if (accessDetails.OwnerID == trans.SellerID || accessDetails.OwnerID == trans.SellerCharacterID)
                    {
                        sellTrans = true;
                    }
                }

                if (buyTrans)
                {
                    // Keep a count of the total amount of each item that has been bought in the
                    // specified buy stations
                    if (buyStations.Count == 0 || buyStations.Contains(trans.StationID))
                    {
                        if (qTotalBuy.ContainsKey(itemID))
                        {
                            qTotalBuy[itemID] = qTotalBuy[itemID] + trans.Quantity;
                        }
                        else
                        {
                            qTotalBuy.Add(itemID, trans.Quantity);
                        }
                    }
                }
                if (sellTrans)
                {
                    // Keep a count of the total amount of each item that has been sold in the
                    // specified sell stations
                    if (sellStations.Count == 0 || sellStations.Contains(stationID))
                    {
                        if (qTotalSell.ContainsKey(itemID))
                        {
                            qTotalSell[itemID] = qTotalSell[itemID] + trans.Quantity;
                        }
                        else
                        {
                            qTotalSell.Add(itemID, trans.Quantity);
                        }
                    }
                }
            }

            foreach (int itemID in allItems)
            {
                long qBuy = 0;
                long qSell = 0;
                if (qTotalBuy.ContainsKey(itemID)) { qBuy = qTotalBuy[itemID]; }
                if (qTotalSell.ContainsKey(itemID)) { qSell = qTotalSell[itemID]; }
                if (qBuy + qSell >= minVolume && qBuy >= minBuy && qSell >= minSell)
                {
                    EMMADataSet.IDTableRow newID = retVal.NewIDTableRow();
                    newID.ID = itemID;
                    retVal.AddIDTableRow(newID);
                }
            }

            return retVal;
        }
Пример #3
0
 /// <summary>
 /// Get a datatable containing the IDs of stations that are involved in transactions that meet
 /// the specifeid criteria
 /// </summary>
 /// <param name="accessParams"></param>
 /// <returns></returns>
 public static EMMADataSet.IDTableDataTable GetInvolvedStationIDs(List<FinanceAccessParams> accessParams)
 {
     EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
     lock (tableAdapter)
     {
         IDTableAdapter.FillStationIDsByTrans(table, FinanceAccessParams.BuildAccessList(accessParams));
     }
     return table;
 }
Пример #4
0
 /// <summary>
 /// Get a datatable containing the IDs of items that are involved in transactions that meet
 /// the specifeid criteria
 /// </summary>
 /// <param name="accessParams"></param>
 /// <returns></returns>
 public static EMMADataSet.IDTableDataTable GetInvolvedItemIDs(List<FinanceAccessParams> accessParams,
     int minVolume, DateTime minDate, DateTime maxDate)
 {
     EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
     lock (tableAdapter)
     {
         IDTableAdapter.FillItemIDsByTrans(table, FinanceAccessParams.BuildAccessList(accessParams),
             minVolume, minDate, maxDate);
     }
     return table;
 }
Пример #5
0
 /// <summary>
 /// Get a datatable containing the IDs of items that are involved in transactions that meet
 /// the specifeid criteria
 /// </summary>
 /// <param name="accessParams"></param>
 /// <returns></returns>
 public static EMMADataSet.IDTableDataTable GetInvolvedItemIDs(List<FinanceAccessParams> accessParams, 
     int minVolume)
 {
     if (minVolume == 0)
     {
         // If we can, use a simpler query, it'll be faster.
         EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
         lock (tableAdapter)
         {
             IDTableAdapter.FillItemIDsByTransNoLimits(table,
                 FinanceAccessParams.BuildAccessList(accessParams));
         }
         return table;
     }
     else
     {
         return GetInvolvedItemIDs(accessParams, minVolume, SqlDateTime.MinValue.Value,
             SqlDateTime.MaxValue.Value);
     }
 }
Пример #6
0
        public static EMMADataSet.IDTableDataTable GetInvolvedSystemIDs(long ownerID,
            List<long> regionIDs, List<long> stationIDs, int itemID, int minimumQuantity,
            bool includeContainers, bool includeContents)
        {
            EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
            if (regionIDs == null) { regionIDs = new List<long>(); }
            if (stationIDs == null) { stationIDs = new List<long>(); }
            if (regionIDs.Count == 0) { regionIDs.Add(0); }
            if (stationIDs.Count == 0) { stationIDs.Add(0); }
            StringBuilder regionIDList = new StringBuilder();
            StringBuilder stationIDList = new StringBuilder();
            foreach (long id in regionIDs)
            {
                if (regionIDList.Length != 0) { regionIDList.Append(","); }
                regionIDList.Append(id);
            }
            foreach (long id in stationIDs)
            {
                if (stationIDList.Length != 0) { stationIDList.Append(","); }
                stationIDList.Append(id);
            }

            lock (assetsTableAdapter)
            {
                IDTableAdapter.FillLimitedSystemIDsByAssets(table, ownerID,
                    regionIDList.ToString(), stationIDList.ToString(), itemID, minimumQuantity,
                    includeContainers, includeContents);
            }
            return table;
        }
Пример #7
0
 public static EMMADataSet.IDTableDataTable GetInvolvedSystemIDs(List<AssetAccessParams> accessParams,
     int itemID, long regionID)
 {
     EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
     lock (assetsTableAdapter)
     {
         IDTableAdapter.FillSystemIDsByAssets(table, AssetAccessParams.BuildAccessList(accessParams),
             itemID, regionID);
     }
     return table;
 }
Пример #8
0
 public static EMMADataSet.IDTableDataTable GetInvolvedItemIDs(List<AssetAccessParams> accessParams)
 {
     EMMADataSet.IDTableDataTable table = new EMMADataSet.IDTableDataTable();
     lock (assetsTableAdapter)
     {
         IDTableAdapter.FillItemIDsByAssets(table, AssetAccessParams.BuildAccessList(accessParams), 0);
     }
     return table;
 }