void MergeFromFile(bool OverlayExistingData, bool updateQuantityOnly)
        {
            OpenFileDialog diag = new OpenFileDialog();

            diag.Title      = "Import from CSV (original spreadsheet)";
            diag.DefaultExt = "csv";
            if (diag.ShowDialog() == true)
            {
                Import(ActiveInventoryCollection.ImportFromSpreadsheet(diag.FileName), false, OverlayExistingData, updateQuantityOnly);
                MessageBox.Show("Import complete.");
            }
        }
        void MergeFromWebsiteFile(bool OverlayExistingData, bool updateQuantityOnly)
        {
            OpenFileDialog diag = new OpenFileDialog();

            diag.Title      = "Import from Website CSV";
            diag.DefaultExt = "csv";
            if (diag.ShowDialog() == true)
            {
                Import(ActiveInventoryCollection.ImportFromWebsiteBase(diag.FileName), true, OverlayExistingData, updateQuantityOnly);
                MessageBox.Show("Import complete.");
            }
        }
        public ActiveInventoryEditor()
        {
            //17 items.
            Inventory = new ActiveInventoryCollection();
            FilteredInventory = new ActiveInventoryCollection();
            foreach (ActiveInventoryObject aio in Cache.Current.Inventory)
            {
                Inventory.Add(aio);
                FilteredInventory.Add(aio);
            }
            

            InitializeComponent();
            RefreshTotals();
        }
예제 #4
0
        public ActiveInventoryEditor()
        {
            //17 items.
            Inventory         = new ActiveInventoryCollection();
            FilteredInventory = new ActiveInventoryCollection();
            foreach (ActiveInventoryObject aio in Cache.Current.Inventory)
            {
                Inventory.Add(aio);
                FilteredInventory.Add(aio);
            }


            InitializeComponent();
            RefreshTotals();
        }
예제 #5
0
        private Cache()
        {
            Inventory = new ActiveInventoryCollection();
            Inventory.Load(InventoryFile);
            InventoryActivity = new TransactionCollection();
            InventoryActivity.Load(InventoryActivityFile);

            ReadyForOpenCartUpdate = new TransactionCollection();
            ReadyForOpenCartUpdate.Load(ReadyToPostFile);

            if (Configuration.Current.FileVersion < Configuration.CurrentFileVersion)
            {
                DoVersionUpdateProcess();
            }

            CurrentFinancials = new FinancialObjectCollection();
            CurrentFinancials.Load(FinancialsFile);


            StagedFinancials = new FinancialObjectCollection();
            StagedFinancials.Load(StagedFinancialsFile);
        }
 void Import(ActiveInventoryCollection newInventory, bool MatchFirstbyProductID, bool OverlayExistingData, bool updateQuantityOnly)
 {
     if (newInventory != null)
     {
         foreach (ActiveInventoryObject aio in newInventory)
         {
             bool matched = false;
             if (MatchFirstbyProductID && aio.ProductID > 0)
             {
                 ActiveInventoryObject oAio = Cache.Current.Inventory.GetByProductID(aio.ProductID);
                 if (oAio != null)
                 {
                     matched = true;
                     if (updateQuantityOnly)
                     {
                         oAio.Quantity = aio.Quantity;
                     }
                     else
                     {
                         oAio.CopyProperties(aio, OverlayExistingData);
                     }
                 }
             }
             if (!matched)
             {
                 if (!string.IsNullOrEmpty(aio.UPC))
                 {
                     List <ActiveInventoryObject> oAioList = Cache.Current.Inventory.GetByUPCorSKU(aio.UPC);
                     if (oAioList.Count == 1)
                     {
                         matched = true;
                         if (updateQuantityOnly)
                         {
                             oAioList[0].Quantity = aio.Quantity;
                         }
                         else
                         {
                             oAioList[0].CopyProperties(aio, OverlayExistingData);
                         }
                     }
                 }
             }
             if (!matched)
             {
                 if (!string.IsNullOrEmpty(aio.SKU))
                 {
                     List <ActiveInventoryObject> oAioList = Cache.Current.Inventory.GetByUPCorSKU(aio.SKU);
                     if (oAioList.Count == 1)
                     {
                         matched = true;
                         if (updateQuantityOnly)
                         {
                             oAioList[0].Quantity = aio.Quantity;
                         }
                         else
                         {
                             oAioList[0].CopyProperties(aio, OverlayExistingData);
                         }
                     }
                 }
             }
             if (!matched)
             {
                 Cache.Current.Inventory.Add(aio);
             }
         }
         Cache.Current.SaveInventory();
     }
 }
 public ReceiveInventory()
 {
     Activity = new ActiveInventoryCollection();
     
     InitializeComponent();
 }
        void Import(ActiveInventoryCollection newInventory, bool MatchFirstbyProductID, bool OverlayExistingData, bool updateQuantityOnly)
        {
            if (newInventory != null)
            {
                foreach (ActiveInventoryObject aio in newInventory)
                {
                    bool matched = false;
                    if (MatchFirstbyProductID && aio.ProductID > 0)
                    {

                        ActiveInventoryObject oAio = Cache.Current.Inventory.GetByProductID(aio.ProductID);
                        if (oAio != null)
                        {
                            matched = true;
                            if (updateQuantityOnly)
                            {
                                oAio.Quantity = aio.Quantity;
                            }
                            else
                            {
                                oAio.CopyProperties(aio, OverlayExistingData);
                            }
                        }


                    }
                    if (!matched)
                    {
                        if (!string.IsNullOrEmpty(aio.UPC))
                        {
                            List<ActiveInventoryObject> oAioList = Cache.Current.Inventory.GetByUPCorSKU(aio.UPC);
                            if (oAioList.Count == 1)
                            {

                                matched = true;
                                if (updateQuantityOnly)
                                {
                                    oAioList[0].Quantity = aio.Quantity;
                                }
                                else
                                {
                                    oAioList[0].CopyProperties(aio, OverlayExistingData);
                                }
                            }
                        }
                    }
                    if (!matched)
                    {
                        if (!string.IsNullOrEmpty(aio.SKU))
                        {
                            List<ActiveInventoryObject> oAioList = Cache.Current.Inventory.GetByUPCorSKU(aio.SKU);
                            if (oAioList.Count == 1)
                            {

                                matched = true;
                                if (updateQuantityOnly)
                                {
                                    oAioList[0].Quantity = aio.Quantity;
                                }
                                else
                                {
                                    oAioList[0].CopyProperties(aio, OverlayExistingData);
                                }
                            }
                        }
                    }
                    if (!matched)
                    {
                        Cache.Current.Inventory.Add(aio);
                    }
                }
                Cache.Current.SaveInventory();
            }
        }
        public ReceiveInventory()
        {
            Activity = new ActiveInventoryCollection();

            InitializeComponent();
        }