コード例 #1
0
        /// <summary>
        /// Checks if the specified row exists in the database.
        /// If it does then the table will contain the row (as well as anything else that was in it
        /// before this method was called)
        /// </summary>
        /// <param name="ordersTable"></param>
        /// <param name="orderRow"></param>
        /// <param name="ID">The ID of the order that matches the supplied one</param>
        /// <returns></returns>
        public static bool Exists(EMMADataSet.OrdersDataTable ordersTable, EMMADataSet.OrdersRow orderRow,
            ref int ID, long corpID, long charID)
        {
            bool? exists = false;
            int? orderID = 0;
            EMMADataSet.OrdersDataTable tempTable = new EMMADataSet.OrdersDataTable();
            tableAdapter.ClearBeforeFill = false;

            lock (tableAdapter)
            {
                tableAdapter.FillOrderExists(tempTable, orderRow.OwnerID, orderRow.WalletID,
                    orderRow.StationID, orderRow.ItemID, orderRow.TotalVol, orderRow.RemainingVol,
                    orderRow.Range, orderRow.OrderState, orderRow.BuyOrder, orderRow.Price, orderRow.EveOrderID,
                    ref exists, ref orderID);
            }
            if (orderID.HasValue)
            {
                if (ordersTable.FindByID(orderID.Value) == null)
                {
                    ordersTable.ImportRow(tempTable.FindByID(orderID.Value));
                }
                else
                {
                    EMMADataSet.OrdersRow existingRow = ordersTable.FindByID(orderID.Value);
                    new EMMAException(ExceptionSeverity.Warning, "market order retreived in 'Exists' is not " +
                        "unique. diagnostics follow:" +
                        "\r\n\tCharacter: " + Names.GetName(charID) +
                        "\r\n\tCorporation: " + Names.GetName(corpID) +
                        "\r\n\tOrder ID: " + orderID.Value +
                        "\r\n\tLooking for this order:" +
                        "\r\n\t\tEve order ID: " + orderRow.EveOrderID +
                        "\r\n\t\tCorp order: " + orderRow.ForCorp.ToString() +
                        "\r\n\t\tStation: " + Stations.GetStationName(orderRow.StationID) +
                        "\r\n\t\tItem: " + Items.GetItemName(orderRow.ItemID) +
                        "\r\n\t\tType: " + (orderRow.BuyOrder ? "Buy" : "Sell") +
                        "\r\n\t\tTotal volume: " + orderRow.TotalVol +
                        "\r\n\t\tRemaining volume: " + orderRow.RemainingVol +
                        "\r\n\t\tPrice: " + orderRow.Price +
                        "\r\n\t\tStatus: " + OrderStates.GetStateDescription(orderRow.OrderState) +
                        "\r\n\tAlready have this order loaded:" +
                        "\r\n\t\tEve order ID: " + existingRow.EveOrderID +
                        "\r\n\t\tCorp order: " + existingRow.ForCorp.ToString() +
                        "\r\n\t\tStation: " + Stations.GetStationName(existingRow.StationID) +
                        "\r\n\t\tItem: " + Items.GetItemName(existingRow.ItemID) +
                        "\r\n\t\tType: " + (existingRow.BuyOrder ? "Buy" : "Sell") +
                        "\r\n\t\tTotal volume: " + existingRow.TotalVol +
                        "\r\n\t\tRemaining volume: " + existingRow.RemainingVol +
                        "\r\n\t\tPrice: " + existingRow.Price +
                        "\r\n\t\tStatus: " + OrderStates.GetStateDescription(existingRow.OrderState), true);
                }
            }

            ID = orderID.HasValue ? orderID.Value : 0;
            return exists.HasValue ? exists.Value : false;
        }
コード例 #2
0
 public static void AddTransByCalcProfitFromAssets(EMMADataSet.TransactionsDataTable trans,
     List<FinanceAccessParams> accessParams, int itemID, bool calcProfitFromAssets)
 {
     lock(tableAdapter)
     {
         bool oldClearBeforeFill = tableAdapter.ClearBeforeFill;
         tableAdapter.ClearBeforeFill = false;
         EMMADataSet.TransactionsDataTable tmpTable = new EMMADataSet.TransactionsDataTable();
         tableAdapter.FillByCalcProfitFromAssets(tmpTable, FinanceAccessParams.BuildAccessList(accessParams),
             itemID, calcProfitFromAssets);
         foreach (EMMADataSet.TransactionsRow tmpTrans in tmpTable)
         {
             EMMADataSet.TransactionsRow match = trans.FindByID(tmpTrans.ID);
             if (match == null)
             {
                 trans.ImportRow(tmpTrans);
             }
         }
         tableAdapter.ClearBeforeFill = oldClearBeforeFill;
     }
 }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="table"></param>
        /// <param name="ownerID"></param>
        /// <param name="corpAsset"></param>
        /// <param name="locationID"></param>
        /// <param name="itemID"></param>
        /// <param name="containerID"></param>
        /// <param name="isContainer"></param>
        /// <param name="assetID"></param>
        /// <returns></returns>
        public static bool AssetExists(EMMADataSet.AssetsDataTable table, long ownerID,
            long locationID, int itemID, int status, bool isContained, long containerID, bool isContainer,
            bool processed, bool ignoreProcessed, bool autoConExclude, bool ignoreAutoConEx,
            long eveItemInstanceID, ref long assetID)
        {
            bool? exists = false;
            long? assetRowID = 0;

            lock (assetsTableAdapter)
            {
                // Have to be carefull here cos the row could well already exist in our table...
                EMMADataSet.AssetsDataTable tmpTable = new EMMADataSet.AssetsDataTable();
                assetsTableAdapter.FillAssetExists(tmpTable, ownerID, locationID, itemID, status,
                    isContained, containerID, isContainer, processed, ignoreProcessed, autoConExclude,
                    ignoreAutoConEx, eveItemInstanceID, ref exists, ref assetRowID);
                long id = assetRowID.HasValue ? assetRowID.Value : 0;
                EMMADataSet.AssetsRow row = table.FindByID(id);
                if (row == null && id != 0)
                {
                    EMMADataSet.AssetsRow dbrow = tmpTable.FindByID(id);
                    table.ImportRow(dbrow);
                }
            }

            assetID = assetRowID.HasValue ? assetRowID.Value : 0;
            return exists.HasValue ? exists.Value : false;
        }