Exemple #1
0
        private void CompareParts()
        {
            //setting local variables
            int  intFirstCounter;
            int  intSecondCounter;
            int  intFirstNumberOfRecords;
            int  intSecondNumberOfRecords;
            bool blnItemFound;
            int  intPartID;
            int  intWarehouseID = 0;
            bool blnFatalError  = false;

            try
            {
                TheItemsNotFoundDataSet.itemsnotfound.Rows.Clear();

                TheFindWarehouseInventoryDataSet = TheInventoryClass.FindWarehouseInventory(gintWarehouseID);

                intFirstNumberOfRecords  = TheFindWarehouseInventoryDataSet.FindWarehouseInventory.Rows.Count - 1;
                intSecondNumberOfRecords = TheImportInventoryDataSet.importinventory.Rows.Count - 1;

                for (intFirstCounter = 0; intFirstCounter <= intFirstNumberOfRecords; intFirstCounter++)
                {
                    blnItemFound = false;
                    intPartID    = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intFirstCounter].PartID;

                    for (intSecondCounter = 0; intSecondCounter <= intSecondNumberOfRecords; intSecondCounter++)
                    {
                        if (intPartID == TheImportInventoryDataSet.importinventory[intSecondCounter].PartID)
                        {
                            blnItemFound = true;
                        }
                    }

                    if (blnItemFound == false)
                    {
                        ItemsNotFoundDataSet.itemsnotfoundRow PartNotFound = TheItemsNotFoundDataSet.itemsnotfound.NewitemsnotfoundRow();

                        PartNotFound.PartID          = intPartID;
                        PartNotFound.PartNumber      = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intFirstCounter].PartNumber;
                        PartNotFound.PartDescription = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intFirstCounter].PartDescription;
                        PartNotFound.JDEPartNumber   = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intFirstCounter].JDEPartNumber;
                        PartNotFound.Quantity        = TheFindWarehouseInventoryDataSet.FindWarehouseInventory[intFirstCounter].Quantity;

                        TheItemsNotFoundDataSet.itemsnotfound.Rows.Add(PartNotFound);
                    }
                }

                intFirstNumberOfRecords = TheFindPartsWarehousesDataSet.FindPartsWarehouses.Rows.Count - 1;

                for (intFirstCounter = 0; intFirstCounter <= intFirstNumberOfRecords; intFirstCounter++)
                {
                    if (TheFindPartsWarehousesDataSet.FindPartsWarehouses[intFirstCounter].FirstName == "MASPRO-HOLDING")
                    {
                        intWarehouseID = TheFindPartsWarehousesDataSet.FindPartsWarehouses[intFirstCounter].EmployeeID;
                    }
                }

                intFirstNumberOfRecords = TheItemsNotFoundDataSet.itemsnotfound.Rows.Count - 1;

                if (intFirstNumberOfRecords > -1)
                {
                    for (intFirstCounter = 0; intFirstCounter <= intFirstNumberOfRecords; intFirstCounter++)
                    {
                        intPartID = TheItemsNotFoundDataSet.itemsnotfound[intFirstCounter].PartID;

                        blnFatalError = TheInventoryClass.MovePartToNewWarehouse(gintWarehouseID, intWarehouseID, intPartID);

                        if (blnFatalError == true)
                        {
                            throw new Exception();
                        }
                    }
                }
            }
            catch (Exception Ex)
            {
                TheEventLogClass.InsertEventLogEntry(DateTime.Now, "Import Mass Pro Inventory // Compare Parts " + Ex.Message);

                TheMessagesClass.ErrorMessage(Ex.ToString());
            }
        }