コード例 #1
0
ファイル: cAmmo.cs プロジェクト: rvicta/ReloadersWorkshop-1
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // PartNumber
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cAmmo Ammo = (cAmmo)Supply;

                rc = cDataFiles.ComparePartNumbers(m_strPartNumber, Ammo.m_strPartNumber);
            }

            return(rc);
        }
コード例 #2
0
        //============================================================================*
        // AddSupply()
        //============================================================================*

        public override bool AddSupply(cSupply Supply, bool fCountOnly = false)
        {
            if (Supply.SupplyType != cSupply.eSupplyTypes.Ammo)
            {
                return(false);
            }

            m_nImportCount++;

            cAmmo Ammo = (cAmmo)Supply;

            foreach (cAmmo CheckAmmo in this)
            {
                if (CheckAmmo.CompareTo(Ammo) == 0)
                {
                    m_nUpdateCount += CheckAmmo.Append(Ammo, fCountOnly);

                    return(false);
                }
            }

            base.AddSupply(Ammo, fCountOnly);

            m_nNewCount++;

            return(true);
        }
コード例 #3
0
ファイル: cPrimer.cs プロジェクト: rvicta/ReloadersWorkshop-1
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // Model
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cPrimer Primer = (cPrimer)Supply;

                rc = cDataFiles.ComparePartNumbers(m_strModel, Primer.m_strModel);
            }

            //----------------------------------------------------------------------------*
            // Return results
            //----------------------------------------------------------------------------*

            return(rc);
        }
コード例 #4
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // Type
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cPowder Powder = (cPowder)Supply;

                rc = cDataFiles.ComparePartNumbers(m_strType, Powder.m_strType);
            }

            return(rc);
        }
コード例 #5
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // Part Number
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cCase Case = (cCase)Supply;

                rc = cDataFiles.ComparePartNumbers(m_strPartNumber, Case.m_strPartNumber);

                //----------------------------------------------------------------------------*
                // Caliber
                //----------------------------------------------------------------------------*

                if (rc == 0)
                {
                    if (m_Caliber == null)
                    {
                        if (Case.m_Caliber == null)
                        {
                            rc = 0;
                        }
                        else
                        {
                            rc = -1;
                        }
                    }
                    else
                    {
                        if (Case.m_Caliber == null)
                        {
                            rc = 1;
                        }
                        else
                        {
                            rc = m_Caliber.CompareTo(Case.m_Caliber);
                        }
                    }
                }
            }

            return(rc);
        }
コード例 #6
0
        //============================================================================*
        // cTransactionListView() - Constructor
        //============================================================================*

        public cTransactionListView(cTransactionList TransactionList, cDataFiles DataFiles, cSupply Supply = null)
            : base(DataFiles, cPreferences.eApplicationListView.TransactionsListView)
        {
            m_TransactionList = TransactionList;
            m_DataFiles       = DataFiles;
            m_Supply          = Supply;

            //----------------------------------------------------------------------------*
            // Set Properties
            //----------------------------------------------------------------------------*

            DoubleBuffered = true;
            CheckBoxes     = true;

            Font = new System.Drawing.Font(Font, System.Drawing.FontStyle.Bold);

            //----------------------------------------------------------------------------*
            // Event Handlers
            //----------------------------------------------------------------------------*

            ListViewItemSorter = new cListViewTransactionComparer(m_DataFiles.Preferences.TransactionSortColumn, m_DataFiles.Preferences.TransactionSortOrder);

            //----------------------------------------------------------------------------*
            // Populate Columns and Groups
            //----------------------------------------------------------------------------*

            SortingOrder = m_DataFiles.Preferences.TransactionSortOrder;

            SortingColumn = m_DataFiles.Preferences.TransactionSortColumn;

            if (m_Supply != null && m_Supply.SupplyType == cSupply.eSupplyTypes.Powder)
            {
                m_arColumns[3].Text += String.Format(" ({0}s)", cDataFiles.MetricString(cDataFiles.eDataType.CanWeight));
            }

            m_arColumns[4].Text += String.Format(" ({0})", m_DataFiles.Preferences.Currency);
            m_arColumns[5].Text += String.Format(" ({0})", m_DataFiles.Preferences.Currency);
            m_arColumns[6].Text += String.Format(" ({0})", m_DataFiles.Preferences.Currency);
            m_arColumns[7].Text += String.Format(" ({0})", m_DataFiles.Preferences.Currency);
            m_arColumns[8].Text += String.Format(" ({0})", m_DataFiles.Preferences.Currency);

            PopulateColumns(m_arColumns);

            //----------------------------------------------------------------------------*
            // Populate Data
            //----------------------------------------------------------------------------*

            Populate();

            Initialized = true;
        }
コード例 #7
0
        //============================================================================*
        // Append()
        //============================================================================*

        public void Append(cTransaction Transaction)
        {
            m_strSource = String.IsNullOrEmpty(m_strSource) ? Transaction.m_strSource : m_strSource;

            m_Supply = m_Supply == null ? Transaction.m_Supply : m_Supply;

            m_dQuantity = m_dQuantity == 0.0 ? Transaction.m_dQuantity : m_dQuantity;
            m_dCost     = m_dCost == 0.0 ? Transaction.m_dCost : m_dCost;
            m_dTax      = m_dTax == 0.0 ? Transaction.m_dTax : m_dTax;
            m_dShipping = m_dShipping == 0.0 ? Transaction.m_dShipping : m_dShipping;
            m_fApplyTax = !m_fApplyTax ? Transaction.m_fApplyTax : false;

            m_fChecked = !m_fChecked ? Transaction.m_fChecked : false;
        }
コード例 #8
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

        public override int CompareTo(Object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            //----------------------------------------------------------------------------*
            // Base Class
            //----------------------------------------------------------------------------*

            cSupply Supply = (cSupply)obj;

            int rc = base.CompareTo(Supply);

            //----------------------------------------------------------------------------*
            // Compare Part Numbers
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                cBullet Bullet = (cBullet)Supply;

                if (string.IsNullOrEmpty(m_strPartNumber))
                {
                    if (!string.IsNullOrEmpty(Bullet.m_strPartNumber))
                    {
                        rc = -1;
                    }
                    else
                    {
                        rc = 0;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(Bullet.m_strPartNumber))
                    {
                        rc = 1;
                    }
                    else
                    {
                        rc = cDataFiles.ComparePartNumbers(m_strPartNumber, Bullet.m_strPartNumber);
                    }
                }
            }

            return(rc);
        }
コード例 #9
0
        //============================================================================*
        // cTransactionForm() - Constructor - Supply
        //============================================================================*

        public cTransactionForm(cSupply Supply, cDataFiles DataFiles)
        {
            InitializeComponent();

            m_DataFiles = DataFiles;

            m_Transaction = new cTransaction();

            m_Transaction.Supply = Supply;

            m_Transaction.TransactionType = m_DataFiles.Preferences.LastActivity;

            if (Supply is cAmmo)
            {
                m_fReload = (Supply as cAmmo).BatchID != 0;
            }

            switch (m_Transaction.TransactionType)
            {
            case cTransaction.eTransactionType.SetStockLevel:
                m_Transaction.Source = "";
                break;

            case cTransaction.eTransactionType.Purchase:
                m_Transaction.Source = m_DataFiles.Preferences.LastPurchaseSource;
                break;

            case cTransaction.eTransactionType.AddStock:
                m_Transaction.Source = m_DataFiles.Preferences.LastAddStockReason;
                break;

            case cTransaction.eTransactionType.ReduceStock:
                m_Transaction.Source = m_DataFiles.Preferences.LastReduceStockReason;
                break;

            case cTransaction.eTransactionType.Fired:
                m_Transaction.Source = m_DataFiles.Preferences.LastFiredLocation;
                break;
            }

            Text = "Add Activity";

            m_fAdd = true;

            OKButton.ButtonType = CommonLib.Controls.cOKButton.eButtonTypes.Add;

            Initialize();
        }
コード例 #10
0
        //============================================================================*
        // Synch() - Case
        //============================================================================*

        public bool Synch(cCase Case)
        {
            if (m_Supply.SupplyType != cSupply.eSupplyTypes.Cases)
            {
                return(false);
            }

            if ((m_Supply as cCase).CompareTo(Case) == 0)
            {
                m_Supply = Case;

                return(true);
            }

            return(false);
        }
コード例 #11
0
        //============================================================================*
        // Synch() - Ammo
        //============================================================================*

        public bool Synch(cAmmo Ammo)
        {
            if (m_Supply.SupplyType != cSupply.eSupplyTypes.Ammo)
            {
                return(false);
            }

            if ((m_Supply as cAmmo).CompareTo(Ammo) == 0)
            {
                m_Supply = Ammo;

                return(true);
            }

            return(false);
        }
コード例 #12
0
        //============================================================================*
        // Synch() - Primer
        //============================================================================*

        public bool Synch(cPrimer Primer)
        {
            if (m_Supply.SupplyType != cSupply.eSupplyTypes.Primers)
            {
                return(false);
            }

            if ((m_Supply as cPrimer).CompareTo(Primer) == 0)
            {
                m_Supply = Primer;

                return(true);
            }

            return(false);
        }
コード例 #13
0
        //============================================================================*
        // Synch() - Bullet
        //============================================================================*

        public bool Synch(cBullet Bullet)
        {
            if (m_Supply.SupplyType != cSupply.eSupplyTypes.Bullets)
            {
                return(false);
            }

            if ((m_Supply as cBullet).CompareTo(Bullet) == 0)
            {
                m_Supply = Bullet;

                return(true);
            }

            return(false);
        }
コード例 #14
0
        //============================================================================*
        // ProcessTransactionList()
        //============================================================================*

        public void ProcessTransactionList(cSupply Supply)
        {
            m_nNumTransactions += Supply.TransactionList.Count();

            foreach (cTransaction Transaction in Supply.TransactionList)
            {
                if (!Transaction.Validate())
                {
                    m_nNumBadTransactions++;
                }

                if (Transaction.Supply != null && Transaction.Supply.CompareTo(Supply) != 0)
                {
                    m_nNumBadTransactions++;
                }
            }
        }
コード例 #15
0
        //============================================================================*
        // Copy()
        //============================================================================*

        public void Copy(cTransaction Transaction)
        {
            m_fAutoTrans = Transaction.m_fAutoTrans;

            m_Date             = Transaction.m_Date;
            m_eTransactionType = Transaction.m_eTransactionType;
            m_strSource        = Transaction.m_strSource;

            m_Supply = Transaction.m_Supply;

            m_nBatchID = Transaction.m_nBatchID;

            m_dQuantity = Transaction.m_dQuantity;
            m_dCost     = Transaction.m_dCost;
            m_dTax      = Transaction.m_dTax;
            m_dShipping = Transaction.m_dShipping;
            m_fApplyTax = Transaction.m_fApplyTax;

            m_fChecked = Transaction.m_fChecked;
        }
コード例 #16
0
        //============================================================================*
        // Export()
        //============================================================================*

        public void Export(StreamWriter Writer, cSupply Supply)
        {
            if (Count <= 0)
            {
                return;
            }

            string strLine = "";

            Writer.WriteLine("TransactionList");
            Writer.WriteLine();

            Writer.WriteLine(cTransaction.CSVLineHeader);
            Writer.WriteLine();

            foreach (cTransaction Transaction in Supply.TransactionList)
            {
                strLine = Transaction.CSVLine;

                Writer.WriteLine(strLine);
            }

            Writer.WriteLine();
        }
コード例 #17
0
        //============================================================================*
        // cSupplyListPreviewDialog() - Constructor
        //============================================================================*

        public cSupplyListPreviewDialog(cDataFiles DataFiles, ListView SuppliesListView)
        {
            m_DataFiles = DataFiles;

            if (m_DataFiles.Preferences.ShoppingListPreviewMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                Location   = m_DataFiles.Preferences.ShoppingListPreviewLocation;
                ClientSize = m_DataFiles.Preferences.ShoppingListPreviewSize;
            }

            if (m_DataFiles.Preferences.SupplyPrintBelowStock)
            {
                Text = String.Format("{0} Supplies Shopping List - Print Preview", Application.ProductName);
            }
            else
            {
                Text = String.Format("{0} Supplies List - Print Preview", Application.ProductName);
            }

            PrintDocument ShoppingListDocument = new PrintDocument();

            ShoppingListDocument.PrintPage += OnPrintPage;

            Document = ShoppingListDocument;

            UseAntiAlias = true;

            //----------------------------------------------------------------------------*
            // Set diameter and weight for bullet list header
            //----------------------------------------------------------------------------*

            m_BulletColumns[1].Name += String.Format(" ({0})", cDataFiles.MetricString(cDataFiles.eDataType.Dimension));
            m_BulletColumns[2].Name += String.Format(" ({0})", cDataFiles.MetricString(cDataFiles.eDataType.BulletWeight));

            //----------------------------------------------------------------------------*
            // Set can weight for powder list header
            //----------------------------------------------------------------------------*

            m_PowderColumns[3].Name += String.Format(" ({0}s)", cDataFiles.MetricString(cDataFiles.eDataType.CanWeight));
            m_PowderColumns[4].Name += String.Format(" ({0}s)", cDataFiles.MetricString(cDataFiles.eDataType.CanWeight));

            //----------------------------------------------------------------------------*
            // Gather the list of supplies, reset flags, and exit
            //----------------------------------------------------------------------------*

            m_SupplyList = new cSupplyList();

            foreach (ListViewItem Item in SuppliesListView.Items)
            {
                cSupply Supply = (cSupply)Item.Tag;

                if (Supply != null && (!m_DataFiles.Preferences.SupplyPrintChecked || Supply.Checked))
                {
                    m_SupplyList.Add(Supply);
                }
            }

            //----------------------------------------------------------------------------*
            // Reset flags and exit
            //----------------------------------------------------------------------------*

            ResetPrintedFlag();

            m_fInitialized = true;
        }
コード例 #18
0
        //============================================================================*
        // cInventoryForm() - Constructor
        //============================================================================*

        public cInventoryForm(cSupply Supply, cDataFiles Datafiles, bool fViewOnly = false, bool fReload = false)
        {
            InitializeComponent();

            m_Supply    = Supply;
            m_DataFiles = Datafiles;
            m_fViewOnly = fViewOnly;

            m_fReload = fReload;

            //----------------------------------------------------------------------------*
            // Create the Transaction List View
            //----------------------------------------------------------------------------*

            m_TransactionListView = new cTransactionListView(m_Supply.TransactionList, m_DataFiles, m_Supply);

            m_TransactionListView.Location = new Point(6, 20);
            m_TransactionListView.Size     = new Size(TotalsGroupBox.Width - 12, AddActivityButton.Location.Y - 26);
            m_TransactionListView.TabIndex = 0;

            ActivityGroupBox.Controls.Add(m_TransactionListView);

            SetClientSizeCore(TotalsGroupBox.Location.X + TotalsGroupBox.Width + 10, CloseButton.Location.Y + CloseButton.Height + 20);

            //----------------------------------------------------------------------------*
            // Set Control Event Handlers
            //----------------------------------------------------------------------------*

            if (!m_fViewOnly)
            {
                m_TransactionListView.SelectedIndexChanged += OnActivitySelected;

                MinimumStockLevelTextBox.TextChanged += OnMinimumStockLevelChanged;

                AddActivityButton.Click    += OnAddActivityClicked;
                EditActivityButton.Click   += OnEditActivityClicked;
                RemoveActivityButton.Click += OnRemoveActivityClicked;
            }
            else
            {
                AddActivityButton.Visible    = false;
                EditActivityButton.Visible   = false;
                RemoveActivityButton.Visible = false;
            }

            ShowBatchCheckBox.Click += OnShowBatchClicked;

            //----------------------------------------------------------------------------*
            // Set Dialog Title
            //----------------------------------------------------------------------------*

            if (m_fViewOnly)
            {
                Text = "View " + Text;
            }
            else
            {
                Text = "Edit " + Text;
            }

            //----------------------------------------------------------------------------*
            // Populate All Inventory Data
            //----------------------------------------------------------------------------*

            ShowBatchCheckBox.Checked = m_DataFiles.Preferences.ShowBatchTransactions;

            SetStaticToolTips();

            PopulateInventoryData();

            m_TransactionListView.Populate();

            m_fInitialized = true;

            UpdateButtons();
        }
コード例 #19
0
        //============================================================================*
        // Import()
        //============================================================================*

        public void Import(cRWXMLDocument XMLDocument, XmlNode XMLThisNode, cDataFiles DataFiles, cSupply Supply)
        {
            XmlNode XMLNode = XMLThisNode.FirstChild;

            while (XMLNode != null)
            {
                switch (XMLNode.Name)
                {
                case "Transaction":
                    cTransaction Transaction = new cTransaction();

                    Transaction.Import(XMLDocument, XMLNode, DataFiles);
                    Transaction.Supply = Supply;

                    AddTransaction(Transaction);

                    break;
                }

                XMLNode = XMLNode.NextSibling;
            }
        }
コード例 #20
0
        //============================================================================*
        // SupplyTotals()
        //============================================================================*

        public cCostAnalysisSupplyTotals SupplyTotals(cSupply Supply)
        {
            cCostAnalysisSupplyTotals SupplyTotals = new cCostAnalysisSupplyTotals();

            SupplyTotals.InStockQty   += m_DataFiles.SupplyQuantity(Supply);
            SupplyTotals.InStockTotal += m_DataFiles.SupplyCost(Supply);

            //----------------------------------------------------------------------------*
            // Loop through the supply transactions
            //----------------------------------------------------------------------------*

            foreach (cTransaction Transaction in Supply.TransactionList)
            {
                //----------------------------------------------------------------------------*
                // See if this transaction meets the filter criteria
                //----------------------------------------------------------------------------*

                if (IncludeTransaction(Transaction))
                {
                    //----------------------------------------------------------------------------*
                    // Add to the overall totals
                    //----------------------------------------------------------------------------*

                    SupplyTotals.NumTransactions++;

                    //----------------------------------------------------------------------------*
                    // Determine the Transaction type
                    //----------------------------------------------------------------------------*

                    switch (Transaction.TransactionType)
                    {
                    //----------------------------------------------------------------------------*
                    // Purchase
                    //----------------------------------------------------------------------------*

                    case cTransaction.eTransactionType.Purchase:
                        SupplyTotals.NumPurchases++;
                        SupplyTotals.PurchaseQty   += Transaction.Quantity;
                        SupplyTotals.PurchaseTotal += Transaction.Cost;

                        if (m_DataFiles.Preferences.IncludeTaxShipping)
                        {
                            SupplyTotals.PurchaseTotal += (Transaction.Tax + Transaction.Shipping);
                        }

                        break;

                    //----------------------------------------------------------------------------*
                    // SetStockLevel
                    //----------------------------------------------------------------------------*

                    case cTransaction.eTransactionType.SetStockLevel:
                        if (Supply.SupplyType != cSupply.eSupplyTypes.Ammo || Transaction.BatchID == 0)
                        {
                            SupplyTotals.NumInitialStock++;
                            SupplyTotals.InitialStockQty   += Transaction.Quantity;
                            SupplyTotals.InitialStockTotal += Transaction.Cost;

                            if (m_DataFiles.Preferences.IncludeTaxShipping)
                            {
                                SupplyTotals.InitialStockTotal += (Transaction.Tax + Transaction.Shipping);
                            }
                        }
                        else
                        {
                            SupplyTotals.NumInitialStock++;
                            SupplyTotals.InitialStockQty   += Transaction.Quantity;
                            SupplyTotals.InitialStockTotal += m_DataFiles.BatchCost(Transaction.BatchID);
                        }

                        break;

                    //----------------------------------------------------------------------------*
                    // AddStock
                    //----------------------------------------------------------------------------*

                    case cTransaction.eTransactionType.AddStock:
                        SupplyTotals.NumAdjustments++;
                        SupplyTotals.AdjustmentsQty   += Transaction.Quantity;
                        SupplyTotals.AdjustmentsTotal += Transaction.Cost;

                        if (m_DataFiles.Preferences.IncludeTaxShipping)
                        {
                            SupplyTotals.AdjustmentsTotal += (Transaction.Tax + Transaction.Shipping);
                        }

                        break;

                    //----------------------------------------------------------------------------*
                    // ReduceStock
                    //----------------------------------------------------------------------------*

                    case cTransaction.eTransactionType.ReduceStock:
                        if (Supply.SupplyType == cSupply.eSupplyTypes.Ammo)
                        {
                            SupplyTotals.NumAdjustments++;
                            SupplyTotals.AdjustmentsQty   -= Transaction.Quantity;
                            SupplyTotals.AdjustmentsTotal -= Transaction.Cost;
                        }
                        else
                        {
                            if (Transaction.BatchID == 0)
                            {
                                SupplyTotals.NumAdjustments++;
                                SupplyTotals.AdjustmentsQty   -= Transaction.Quantity;
                                SupplyTotals.AdjustmentsTotal -= Transaction.Cost;
                            }
                            else
                            {
                                SupplyTotals.NumUsed++;

                                switch (Supply.SupplyType)
                                {
                                case cSupply.eSupplyTypes.Bullets:
                                    SupplyTotals.UsedQty   -= Transaction.Quantity;
                                    SupplyTotals.UsedTotal -= m_DataFiles.BatchBulletCost(Transaction.BatchID);
                                    break;

                                case cSupply.eSupplyTypes.Cases:
                                    SupplyTotals.UsedQty   -= Transaction.Quantity;
                                    SupplyTotals.UsedTotal -= m_DataFiles.BatchCaseCost(Transaction.BatchID);
                                    break;

                                case cSupply.eSupplyTypes.Powder:
                                    SupplyTotals.UsedQty   -= Transaction.Quantity;
                                    SupplyTotals.UsedTotal -= m_DataFiles.BatchPowderCost(Transaction.BatchID);
                                    break;

                                case cSupply.eSupplyTypes.Primers:
                                    SupplyTotals.UsedQty   -= Transaction.Quantity;
                                    SupplyTotals.UsedTotal -= m_DataFiles.BatchPrimerCost(Transaction.BatchID);
                                    break;
                                }
                            }
                        }

                        break;

                    //----------------------------------------------------------------------------*
                    // Fired
                    //----------------------------------------------------------------------------*

                    case cTransaction.eTransactionType.Fired:
                        SupplyTotals.NumFired++;

                        SupplyTotals.FiredQty   += Transaction.Quantity;
                        SupplyTotals.FiredTotal += Transaction.Cost;

                        break;
                    }
                }
            }

            if (Supply.SupplyType == cSupply.eSupplyTypes.Powder)
            {
                SupplyTotals.AdjustmentsQty  /= 7000.0;
                SupplyTotals.FiredQty        /= 7000.0;
                SupplyTotals.InitialStockQty /= 7000.0;
                SupplyTotals.InStockQty      /= 7000.0;
                SupplyTotals.PurchaseQty     /= 7000.0;
                SupplyTotals.UsedQty         /= 7000.0;

                SupplyTotals.AdjustmentsQty  = cDataFiles.StandardToMetric(SupplyTotals.AdjustmentsQty, cDataFiles.eDataType.CanWeight);
                SupplyTotals.FiredQty        = cDataFiles.StandardToMetric(SupplyTotals.FiredQty, cDataFiles.eDataType.CanWeight);
                SupplyTotals.InitialStockQty = cDataFiles.StandardToMetric(SupplyTotals.InitialStockQty, cDataFiles.eDataType.CanWeight);
                SupplyTotals.InStockQty      = cDataFiles.StandardToMetric(SupplyTotals.InStockQty, cDataFiles.eDataType.CanWeight);
                SupplyTotals.PurchaseQty     = cDataFiles.StandardToMetric(SupplyTotals.PurchaseQty, cDataFiles.eDataType.CanWeight);
                SupplyTotals.UsedQty         = cDataFiles.StandardToMetric(SupplyTotals.UsedQty, cDataFiles.eDataType.CanWeight);
            }

            return(SupplyTotals);
        }
コード例 #21
0
        //============================================================================*
        // ResolveIdentities()
        //============================================================================*

        public bool ResolveIdentities(cDataFiles Datafiles)
        {
            bool fChanged = false;

            if (m_Supply.Identity)
            {
                switch (m_Supply.SupplyType)
                {
                //----------------------------------------------------------------------------*
                // Ammo
                //----------------------------------------------------------------------------*

                case cSupply.eSupplyTypes.Ammo:
                    foreach (cAmmo Ammo in Datafiles.AmmoList)
                    {
                        if (!Ammo.Identity && (m_Supply as cAmmo).CompareTo(Ammo) == 0)
                        {
                            m_Supply = Ammo;

                            fChanged = true;

                            break;
                        }
                    }

                    break;

                //----------------------------------------------------------------------------*
                // Bullets
                //----------------------------------------------------------------------------*

                case cSupply.eSupplyTypes.Bullets:
                    foreach (cBullet Bullet in Datafiles.BulletList)
                    {
                        if (!Bullet.Identity && (m_Supply as cBullet).CompareTo(Bullet) == 0)
                        {
                            m_Supply = Bullet;

                            fChanged = true;

                            break;
                        }
                    }

                    break;

                //----------------------------------------------------------------------------*
                // Cases
                //----------------------------------------------------------------------------*

                case cSupply.eSupplyTypes.Cases:
                    foreach (cCase Case in Datafiles.CaseList)
                    {
                        if (!Case.Identity && (m_Supply as cCase).CompareTo(Case) == 0)
                        {
                            m_Supply = Case;

                            fChanged = true;

                            break;
                        }
                    }

                    break;

                //----------------------------------------------------------------------------*
                // Primers
                //----------------------------------------------------------------------------*

                case cSupply.eSupplyTypes.Primers:
                    foreach (cPrimer Primer in Datafiles.PrimerList)
                    {
                        if (!Primer.Identity && (m_Supply as cPrimer).CompareTo(Primer) == 0)
                        {
                            m_Supply = Primer;

                            fChanged = true;

                            break;
                        }
                    }

                    break;

                //----------------------------------------------------------------------------*
                // Powder
                //----------------------------------------------------------------------------*

                case cSupply.eSupplyTypes.Powder:
                    foreach (cPowder Powder in Datafiles.PowderList)
                    {
                        if (!Powder.Identity && (m_Supply as cPowder).CompareTo(Powder) == 0)
                        {
                            m_Supply = Powder;

                            fChanged = true;

                            break;
                        }
                    }

                    break;
                }
            }

            return(fChanged);
        }