Esempio n. 1
0
        //============================================================================*
        // UpdateTool()
        //============================================================================*

        private void UpdateTool(cTool OldTool, cTool NewTool)
        {
            //----------------------------------------------------------------------------*
            // Find the NewFirearm
            //----------------------------------------------------------------------------*

            foreach (cTool CheckTool in m_DataFiles.ToolList)
            {
                //----------------------------------------------------------------------------*
                // See if this is the same Firearm
                //----------------------------------------------------------------------------*

                if (CheckTool.CompareTo(OldTool) == 0)
                {
                    //----------------------------------------------------------------------------*
                    // Update the current Tool record
                    //----------------------------------------------------------------------------*

                    CheckTool.Copy(NewTool);

                    //----------------------------------------------------------------------------*
                    // Update the Firearm on the Firearm tab
                    //----------------------------------------------------------------------------*

                    ListViewItem Item = null;

                    foreach (ListViewItem CheckItem in m_ToolsListView.Items)
                    {
                        if ((CheckItem.Tag as cTool).CompareTo(CheckTool) == 0)
                        {
                            Item = CheckItem;

                            break;
                        }
                    }

                    if (Item != null)
                    {
                        try
                        {
                            m_ToolsListView.Items.Remove(Item);
                        }
                        catch
                        {
                            // No need to do anything here
                        }

                        m_ToolsListView.AddTool(CheckTool, true);
                    }

                    return;
                }
            }

            //----------------------------------------------------------------------------*
            // If the NewFirearm was not found, add it
            //----------------------------------------------------------------------------*

            AddTool(NewTool);
        }
Esempio n. 2
0
        //============================================================================*
        // OnViewTool()
        //============================================================================*

        protected void OnViewTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected object
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_ToolsListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cTool Tool = (cTool)Item.Tag;

            if (Tool == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(Tool, m_DataFiles, true);

            Cursor = Cursors.Default;

            ToolForm.ShowDialog();

            m_ToolsListView.Focus();
        }
Esempio n. 3
0
        //============================================================================*
        // AddTool()
        //============================================================================*

        private void AddTool(cTool Tool)
        {
            //----------------------------------------------------------------------------*
            // If the Tool already exists, our job is done, just exit
            //----------------------------------------------------------------------------*

            foreach (cTool CheckTool in m_DataFiles.ToolList)
            {
                if (CheckTool.CompareTo(Tool) == 0)
                {
                    return;
                }
            }

            //----------------------------------------------------------------------------*
            // Otherwise, add the new firearm to the list
            //----------------------------------------------------------------------------*

            m_DataFiles.ToolList.Add(Tool);

            //----------------------------------------------------------------------------*
            // And add the new Tool to the Tool ListView
            //----------------------------------------------------------------------------*

            m_ToolsListView.AddTool(Tool, true);

            AddToolButton.Focus();
        }
Esempio n. 4
0
        //============================================================================*
        // OnRemoveTool()
        //============================================================================*

        protected void OnRemoveTool(object sender, EventArgs args)
        {
            cTool Tool = null;

            ListViewItem Item = m_ToolsListView.SelectedItems[0];

            if (Item != null)
            {
                Tool = (cTool)Item.Tag;
            }

            if (Tool == null)
            {
                m_ToolsListView.Focus();

                return;
            }

            //----------------------------------------------------------------------------*
            // Make sure the user is sure
            //----------------------------------------------------------------------------*

            if (MessageBox.Show(this, "Are you sure you wish to remove this tool/accessory?", "Data Deletion Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                m_DataFiles.DeleteTool(Tool);

                m_ToolsListView.Items.Remove(Item);
            }

            UpdateToolsTabButtons();

            m_ToolsListView.Focus();
        }
Esempio n. 5
0
        //============================================================================*
        // AddTool()
        //============================================================================*

        public ListViewItem AddTool(cTool Tool, bool fSelect = true)
        {
            //----------------------------------------------------------------------------*
            // Verify that the Tool should be added to the list
            //----------------------------------------------------------------------------*

            if (!VerifyTool(Tool))
            {
                return(null);
            }

            //----------------------------------------------------------------------------*
            // Create the ListViewItem
            //----------------------------------------------------------------------------*

            ListViewItem Item = new ListViewItem();

            SetToolData(Item, Tool);

            //----------------------------------------------------------------------------*
            // Add the item to the list and exit
            //----------------------------------------------------------------------------*

            AddItem(Item, fSelect);

            return(Item);
        }
Esempio n. 6
0
        //============================================================================*
        // VerifyTool()
        //============================================================================*

        public bool VerifyTool(cTool Tool)
        {
            //----------------------------------------------------------------------------*
            // Check Filters
            //----------------------------------------------------------------------------*

            if (!m_afFilters[(int)Tool.ToolType])
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        //============================================================================*
        // Copy()
        //============================================================================*

        public virtual void Copy(cTool Tool)
        {
            m_eType        = Tool.m_eType;
            m_Manufacturer = Tool.m_Manufacturer;

            m_strPartNumber   = Tool.m_strPartNumber;
            m_strSerialNumber = Tool.m_strSerialNumber;
            m_strDescription  = Tool.m_strDescription;
            m_strNotes        = Tool.m_strNotes;
            m_strSource       = Tool.m_strSource;
            m_Date            = Tool.PurchaseDate;
            m_dPrice          = Tool.m_dPrice;
            m_dTax            = Tool.m_dTax;
            m_dShipping       = Tool.m_dShipping;
        }
Esempio n. 8
0
        //============================================================================*
        // OnEditTool()
        //============================================================================*

        protected void OnEditTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Get the selected Firearm
            //----------------------------------------------------------------------------*

            ListViewItem Item = m_ToolsListView.SelectedItems[0];

            if (Item == null)
            {
                return;
            }

            cTool Tool = (cTool)Item.Tag;

            if (Tool == null)
            {
                return;
            }

            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(Tool, m_DataFiles);

            Cursor = Cursors.Default;

            if (ToolForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Tool Data
                //----------------------------------------------------------------------------*

                cTool NewTool = ToolForm.Tool;
                m_DataFiles.Preferences.LastTool = ToolForm.Tool;

                UpdateTool(Tool, NewTool);
            }

            UpdateToolsTabButtons();

            m_ToolsListView.Focus();
        }
Esempio n. 9
0
        //============================================================================*
        // OnToolSelected()
        //============================================================================*

        protected void OnToolSelected(object sender, EventArgs args)
        {
            if (!m_fInitialized || m_ToolsListView.Populating)
            {
                return;
            }

            cTool Tool = null;

            if (m_ToolsListView.SelectedItems.Count > 0)
            {
                Tool = (cTool)m_ToolsListView.SelectedItems[0].Tag;

                m_DataFiles.Preferences.LastToolSelected = Tool;
            }

            UpdateToolsTabButtons();
        }
Esempio n. 10
0
        //============================================================================*
        // UpdateTool()
        //============================================================================*

        public ListViewItem UpdateTool(cTool Tool, bool fSelect = false)
        {
            //----------------------------------------------------------------------------*
            // Find the Item
            //----------------------------------------------------------------------------*

            ListViewItem Item = null;

            foreach (ListViewItem CheckItem in Items)
            {
                if ((CheckItem.Tag as cTool).CompareTo(Tool) == 0)
                {
                    Item = CheckItem;

                    break;
                }
            }

            //----------------------------------------------------------------------------*
            // If the item was not found, add it
            //----------------------------------------------------------------------------*

            if (Item == null)
            {
                return(AddTool(Tool, fSelect));
            }

            //----------------------------------------------------------------------------*
            // Otherwise, update the Item Data
            //----------------------------------------------------------------------------*

            SetToolData(Item, Tool);

            if (fSelect)
            {
                Item.Selected = fSelect;

                Item.EnsureVisible();
            }

            return(Item);
        }
Esempio n. 11
0
        //============================================================================*
        // CompareTool()
        //============================================================================*

        public int CompareTool(cTool Tool1, cTool Tool2)
        {
            int rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

            if (rc == 0)
            {
                rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                if (rc == 0)
                {
                    rc = Tool1.Description.CompareTo(Tool2.Description);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);
                    }
                }
            }

            return(rc);
        }
Esempio n. 12
0
        //============================================================================*
        // OnAddTool()
        //============================================================================*

        protected void OnAddTool(object sender, EventArgs args)
        {
            //----------------------------------------------------------------------------*
            // Start the dialog
            //----------------------------------------------------------------------------*

            Cursor = Cursors.WaitCursor;

            cToolForm ToolForm = new cToolForm(null, m_DataFiles);

            Cursor = Cursors.Default;

            if (ToolForm.ShowDialog() == DialogResult.OK)
            {
                //----------------------------------------------------------------------------*
                // Get the new Tool Data
                //----------------------------------------------------------------------------*

                cTool NewTool = ToolForm.Tool;
                m_DataFiles.Preferences.LastTool = ToolForm.Tool;

                m_ToolsListView.Focus();

                //----------------------------------------------------------------------------*
                // See if the Tool already exists
                //----------------------------------------------------------------------------*

                foreach (cTool CheckTool in m_DataFiles.ToolList)
                {
                    if (CheckTool.CompareTo(NewTool) == 0)
                    {
                        return;
                    }
                }

                AddTool(NewTool);
            }

            UpdateToolsTabButtons();
        }
Esempio n. 13
0
        //============================================================================*
        // SetToolData()
        //============================================================================*

        public void SetToolData(ListViewItem Item, cTool Tool)
        {
            Item.SubItems.Clear();

            Item.Text = Tool.Manufacturer.ToString();

            Item.Group = Groups[(int)Tool.ToolType];
            Item.Tag   = Tool;

            Item.SubItems.Add(String.Format("{0}", Tool.PartNumber));
            Item.SubItems.Add(String.Format("{0}", Tool.SerialNumber));
            Item.SubItems.Add(String.Format("{0}", Tool.Description));

            Item.SubItems.Add(String.Format("{0}", Tool.Source));
            Item.SubItems.Add(!String.IsNullOrEmpty(Tool.Source) ? String.Format("{0}", Tool.PurchaseDate.ToShortDateString()) : "");
            Item.SubItems.Add(!String.IsNullOrEmpty(Tool.Source) && Tool.PurchasePrice > 0.0 ? String.Format("{0:F2}", Tool.PurchasePrice) : "-");
            Item.SubItems.Add(!String.IsNullOrEmpty(Tool.Source) && Tool.Tax > 0.0 ? String.Format("{0:F2}", Tool.Tax) : "-");
            Item.SubItems.Add(!String.IsNullOrEmpty(Tool.Source) && Tool.Shipping > 0.0 ? String.Format("{0:F2}", Tool.Shipping) : "-");

            double dTotal = Tool.PurchasePrice + Tool.Tax + Tool.Shipping;

            Item.SubItems.Add(!String.IsNullOrEmpty(Tool.Source) && dTotal != 0.0 ? String.Format("{0:F2}", dTotal) : "-");
        }
Esempio n. 14
0
        //============================================================================*
        // Comparer()
        //============================================================================*

        public static int Comparer(cTool Tool1, cTool Tool2)
        {
            if (Tool1 == null)
            {
                if (Tool2 != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Tool2 == null)
                {
                    return(1);
                }
            }

            return(Tool1.CompareTo(Tool2));
        }
Esempio n. 15
0
        //============================================================================*
        // SetToolsCostDetails()
        //============================================================================*

        public void SetToolsCostDetails()
        {
            int    nCount         = 0;
            double dTotalCost     = 0.0;
            double dTotalTaxes    = 0.0;
            double dTotalShipping = 0.0;
            double dGrandTotal    = 0.0;

            foreach (ListViewItem Item in m_ToolsListView.Items)
            {
                cTool Tool = (cTool)Item.Tag;

                if (Tool != null)
                {
                    nCount++;

                    dTotalTaxes    += Tool.Tax;
                    dTotalShipping += Tool.Shipping;

                    dTotalCost += Tool.PurchasePrice;
                }
            }

            dGrandTotal = dTotalCost + dTotalTaxes + dTotalShipping;

            ToolsCountLabel.Text = String.Format("{0}", nCount);

            ToolsTotalCostLabel.Text = String.Format("{0:N2}", dTotalCost);

            ToolsTotalTaxLabel.Text      = string.Format("{0:N2}", dTotalTaxes);
            ToolsTotalShippingLabel.Text = string.Format("{0:N2}", dTotalShipping);

            dGrandTotal = dTotalCost + dTotalTaxes + dTotalShipping;

            ToolsGrandTotalLabel.Text = string.Format("{0}{1:N2}", m_DataFiles.Preferences.Currency, dGrandTotal);
        }
Esempio n. 16
0
        //============================================================================*
        // Append()
        //============================================================================*

        public int Append(cTool Tool, bool fCountOnly = false)
        {
            int nUpdateCount = 0;

            if (String.IsNullOrEmpty(m_strDescription) && !String.IsNullOrEmpty(Tool.m_strDescription))
            {
                if (!fCountOnly)
                {
                    m_strDescription = Tool.m_strDescription;
                }

                nUpdateCount++;
            }

            if (String.IsNullOrEmpty(m_strSerialNumber) && !String.IsNullOrEmpty(Tool.m_strSerialNumber))
            {
                if (!fCountOnly)
                {
                    m_strSerialNumber = Tool.m_strSerialNumber;
                }

                nUpdateCount++;
            }

            if (String.IsNullOrEmpty(m_strNotes) && !String.IsNullOrEmpty(Tool.m_strNotes))
            {
                if (!fCountOnly)
                {
                    m_strNotes = Tool.m_strNotes;
                }

                nUpdateCount++;
            }

            if (String.IsNullOrEmpty(m_strSource) && !String.IsNullOrEmpty(Tool.m_strSource))
            {
                if (!fCountOnly)
                {
                    m_strSource = Tool.m_strSource;
                }

                nUpdateCount++;
            }

            if (m_dPrice == 0.0 && Tool.m_dPrice != 0.0)
            {
                if (!fCountOnly)
                {
                    m_dPrice = Tool.m_dPrice;
                }

                nUpdateCount++;
            }

            if (m_dTax == 0.0 && Tool.m_dTax != 0.0)
            {
                if (!fCountOnly)
                {
                    m_dTax = Tool.m_dTax;
                }

                nUpdateCount++;
            }

            if (m_dShipping == 0.0 && Tool.m_dShipping != 0.0)
            {
                if (!fCountOnly)
                {
                    m_dShipping = Tool.m_dShipping;
                }

                nUpdateCount++;
            }

            return(nUpdateCount);
        }
Esempio n. 17
0
        //============================================================================*
        // CompareTo()
        //============================================================================*

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

            int rc = 0;

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

            cTool Tool = (cTool)obj;

            if (sm_fSortByType)
            {
                rc = m_eType.CompareTo(Tool.m_eType);
            }

            //----------------------------------------------------------------------------*
            // Manufacturer
            //----------------------------------------------------------------------------*

            if (rc == 0)
            {
                if (m_Manufacturer != null)
                {
                    rc = m_Manufacturer.CompareTo(Tool.m_Manufacturer);
                }
                else
                {
                    if (Tool.m_Manufacturer != null)
                    {
                        rc = -1;
                    }
                    else
                    {
                        rc = 0;
                    }
                }

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

                if (rc == 0)
                {
                    rc = cDataFiles.ComparePartNumbers(m_strPartNumber, Tool.PartNumber);

                    //----------------------------------------------------------------------------*
                    // Serial Number
                    //----------------------------------------------------------------------------*

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(m_strSerialNumber, Tool.SerialNumber);
                    }
                }
            }

            return(rc);
        }
Esempio n. 18
0
        //============================================================================*
        // ToolTypeString() - cTool
        //============================================================================*

        public static string ToolTypeString(cTool Tool)
        {
            return(ToolTypeString(Tool.ToolType));
        }
Esempio n. 19
0
        //============================================================================*
        // cTool() - Copy Constructor
        //============================================================================*

        public cTool(cTool Gear)
        {
            Copy(Gear);
        }
Esempio n. 20
0
        //============================================================================*
        // cToolForm()
        //============================================================================*

        public cToolForm(cTool Tool, cDataFiles DataFiles, bool fViewOnly = false)
        {
            InitializeComponent();

            m_DataFiles = DataFiles;

            m_fViewOnly = fViewOnly;

            if (Tool == null)
            {
                m_Tool = new cTool(cTool.eToolTypes.Other);
            }
            else
            {
                m_Tool = new cTool(Tool);
            }

            SetClientSizeCore(GeneralGroupBox.Location.X + GeneralGroupBox.Width + 10, FormCancelButton.Location.Y + FormCancelButton.Height + 20);

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

            if (!m_fViewOnly)
            {
                // General

                TypeCombo.SelectedIndexChanged         += OnTypeChanged;
                ManufacturerCombo.SelectedIndexChanged += OnManufacturerChanged;
                PartNumberTextBox.TextChanged          += OnPartNumberChanged;
                SerialNumberTextBox.TextChanged        += OnSerialNumberChanged;
                DescriptionTextBox.TextChanged         += OnDescriptionChanged;
                NotesTextBox.TextChanged += OnNotesChanged;

                // Acquisition Details

                SourceCombo.TextChanged         += OnSourceChanged;
                PurchaseDatePicker.ValueChanged += OnPurchaseDateChanged;
                PriceTextBox.TextChanged        += OnPriceChanged;
                TaxTextBox.TextChanged          += OnTaxChanged;
                ShippingTextBox.TextChanged     += OnShippingChanged;
            }
            else
            {
                // General

                PartNumberTextBox.ReadOnly   = true;
                SerialNumberTextBox.ReadOnly = true;
                DescriptionTextBox.ReadOnly  = true;
                NotesTextBox.ReadOnly        = true;

                // Acquisition Details

                SourceCombo.Enabled        = false;
                PurchaseDatePicker.Enabled = false;
                PriceTextBox.ReadOnly      = true;
                TaxTextBox.ReadOnly        = true;
                ShippingTextBox.ReadOnly   = true;
            }

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

            string strTitle = "Add Tool or Equipment";

            if (m_fViewOnly)
            {
                strTitle = strTitle.Replace("Add", "View");

                OKButton.Visible = false;

                FormCancelButton.Text = "Close";

                FormCancelButton.Location = new Point((ClientRectangle.Width / 2) - (FormCancelButton.Width / 2), FormCancelButton.Location.Y);

                m_fAdd = false;
            }
            else
            {
                if (Tool != null)
                {
                    strTitle = strTitle.Replace("Add", "Edit");

                    OKButton.Text = "Update";

                    m_fAdd = false;
                }
                else
                {
                    OKButton.Text = "Add";

                    m_fAdd = true;
                }
            }

            Text = strTitle;

            //----------------------------------------------------------------------------*
            // Set Gear Data Fields
            //----------------------------------------------------------------------------*

            //			SetInputParameters();

            SetStaticToolTips();

            SetInputParameters();

            PopulateTypeCombo();

            PopulateSourceCombo();

            PopulateToolData();

            m_fInitialized = true;

            UpdateButtons();
        }
Esempio n. 21
0
        //============================================================================*
        // Compare()
        //============================================================================*

        public override int Compare(Object Object1, Object Object2)
        {
            if (Object1 == null)
            {
                if (Object2 == null)
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                if (Object2 == null)
                {
                    return(1);
                }
            }

            cTool Tool1 = (cTool)(Object1 as ListViewItem).Tag;
            cTool Tool2 = (cTool)(Object2 as ListViewItem).Tag;

            if (Tool1 == null)
            {
                if (Tool2 == null)
                {
                    return(0);
                }
                else
                {
                    return(0);
                }
            }
            else
            {
                if (Tool2 == null)
                {
                    return(1);
                }
            }

            //----------------------------------------------------------------------------*
            // Do Special Compares
            //----------------------------------------------------------------------------*

            bool fSpecial = false;
            int  rc       = 0;

            switch (SortColumn)
            {
            //----------------------------------------------------------------------------*
            // Manufacturer
            //----------------------------------------------------------------------------*

            case 0:
                rc = CompareTool(Tool1, Tool2);

                fSpecial = true;

                break;

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

            case 1:
                rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Serial  Number
            //----------------------------------------------------------------------------*

            case 2:
                rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Description
            //----------------------------------------------------------------------------*

            case 3:
                rc = Tool1.Description.CompareTo(Tool2.Description);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);
                        }
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Firearm
            //----------------------------------------------------------------------------*

            case 4:
                rc = (Object1 as ListViewItem).SubItems[4].Text.CompareTo((Object2 as ListViewItem).SubItems[4].Text);

                if (rc == 0)
                {
                    CompareTool(Tool1, Tool2);
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Source
            //----------------------------------------------------------------------------*

            case 5:
                rc = Tool1.Source.CompareTo(Tool2.Source);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                            if (rc == 0)
                            {
                                rc = Tool1.Description.CompareTo(Tool2.Description);
                            }
                        }
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Date
            //----------------------------------------------------------------------------*

            case 6:
                rc = Tool1.PurchaseDate.CompareTo(Tool2.PurchaseDate);

                if (rc == 0)
                {
                    rc = CompareTool(Tool1, Tool2);
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Price
            //----------------------------------------------------------------------------*

            case 7:
                rc = Tool1.PurchasePrice.CompareTo(Tool2.PurchasePrice);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = Tool1.Description.CompareTo(Tool2.Description);

                            if (rc == 0)
                            {
                                rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                                if (rc == 0)
                                {
                                    rc = Tool1.Source.CompareTo(Tool2.Source);
                                }
                            }
                        }
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Tax
            //----------------------------------------------------------------------------*

            case 8:
                rc = Tool1.Tax.CompareTo(Tool2.Tax);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = Tool1.Description.CompareTo(Tool2.Description);

                            if (rc == 0)
                            {
                                rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                                if (rc == 0)
                                {
                                    rc = Tool1.Source.CompareTo(Tool2.Source);
                                }
                            }
                        }
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Shipping
            //----------------------------------------------------------------------------*

            case 9:
                rc = Tool1.Shipping.CompareTo(Tool2.Shipping);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = Tool1.Description.CompareTo(Tool2.Description);

                            if (rc == 0)
                            {
                                rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                                if (rc == 0)
                                {
                                    rc = Tool1.Source.CompareTo(Tool2.Source);
                                }
                            }
                        }
                    }
                }

                fSpecial = true;

                break;

            //----------------------------------------------------------------------------*
            // Total
            //----------------------------------------------------------------------------*

            case 10:
                double dTotal1 = 0.0;

                if ((Object1 as ListViewItem).Text != "-")
                {
                    Double.TryParse((Object1 as ListViewItem).SubItems[10].Text, out dTotal1);
                }

                double dTotal2 = 0.0;

                if ((Object2 as ListViewItem).Text != "-")
                {
                    Double.TryParse((Object2 as ListViewItem).SubItems[10].Text, out dTotal2);
                }

                rc = dTotal1.CompareTo(dTotal2);

                if (rc == 0)
                {
                    rc = Tool1.Manufacturer.CompareTo(Tool2.Manufacturer);

                    if (rc == 0)
                    {
                        rc = cDataFiles.ComparePartNumbers(Tool1.PartNumber, Tool2.PartNumber);

                        if (rc == 0)
                        {
                            rc = Tool1.Description.CompareTo(Tool2.Description);

                            if (rc == 0)
                            {
                                rc = cDataFiles.ComparePartNumbers(Tool1.SerialNumber, Tool2.SerialNumber);

                                if (rc == 0)
                                {
                                    rc = Tool1.Source.CompareTo(Tool2.Source);
                                }
                            }
                        }
                    }
                }

                fSpecial = true;

                break;
            }

            if (fSpecial)
            {
                if (SortingOrder == SortOrder.Descending)
                {
                    return(0 - rc);
                }

                return(rc);
            }

            return(base.Compare(Object1, Object2));
        }