public void ChangeSingleItemCategory(ItemViewModel _item, CategoryViewModel _changeTo, out ItemViewModel x)
 {
     FindCategoryUsingId(_item.Category).RemoveItem(_item);
     SaveDataHandler.SwapItemTable(_item, _changeTo.Id);
     _item.Category = _changeTo.Id;
     Categories[Categories.IndexOf(_changeTo)].AddItem(_item);
     x = _item;
 }
 public void AddNewItemToCategory(CategoryViewModel _cat, ItemViewModel _item)
 {
     _item.Category = _cat.Id;
     Categories[Categories.IndexOf(_cat)].AddItem(_item);
     NotifyPropertyChanged("SelectedCategoryItems");
 }
Esempio n. 3
0
 public void RemoveItem(ItemViewModel _item)
 {
     category.Items.Remove(_item);
     NotifyPropertyChanged("ItemCount");
     NotifyPropertyChanged("Item");
 }
Esempio n. 4
0
 public void AddItem(ItemViewModel _item)
 {
     category.Items.Add(_item);
     NotifyPropertyChanged("ItemCount");
     NotifyPropertyChanged("Item");
 }
Esempio n. 5
0
        public string GetCompareItemChanges(ItemViewModel x, ItemViewModel y)
        {
            if (x == null || y == null)
            {
                return("");
            }

            string changes = "";

            if (!x.Name.Equals(y.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nNAME changed FROM '{0}' TO '{1}'", x.Name, y.Name);
            }

            if (!x.Category.Equals(y.Category, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nCATEGORY changed FROM '{0}' TO '{1}'", x.Category, y.Category);
            }

            if (!x.Description.Equals(y.Description, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nDESCRIPTION changed FROM '{0}' TO '{1}'", x.Description, y.Description);
            }


            if (!x.Detail.Company.Equals(y.Detail.Company, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nCOMPANY changed FROM '{0}' TO '{1}'", x.Detail.Company, y.Detail.Company);
            }

            if (!x.Detail.Address.Equals(y.Detail.Address, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nADDRESS changed FROM '{0}' TO '{1}'", x.Detail.Address, y.Detail.Address);
            }

            if (!x.Detail.Phone.Equals(y.Detail.Phone, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nPHONE changed FROM '{0}' TO '{1}'", x.Detail.Phone, y.Detail.Phone);
            }

            if (!x.Detail.Email.Equals(y.Detail.Email, StringComparison.InvariantCultureIgnoreCase))
            {
                changes += string.Format("\nEMAIL changed FROM '{0}' TO '{1}'", x.Detail.Email, y.Detail.Email);
            }

            if (!x.Detail.Date.Equals(y.Detail.Date))
            {
                changes += string.Format("\nDATE changed FROM '{0}' TO '{1}'", x.Detail.Date, y.Detail.Date);
            }

            Console.WriteLine("x " + x.Quantity.Total);
            Console.WriteLine("y " + y.Quantity.Total);
            if (x.Price.CurrentPrice != y.Price.CurrentPrice)
            {
                changes += string.Format("\nCURRENT PRICE changed FROM '{0}' TO '{1}'", x.Price.CurrentPrice, y.Price.CurrentPrice);
            }

            if (x.Price.RegularPrice != y.Price.RegularPrice)
            {
                changes += string.Format("\nREGULAR PRICE changed FROM '{0}' TO '{1}'", x.Price.RegularPrice, y.Price.RegularPrice);
            }

            if (x.Price.SalePrice != y.Price.SalePrice)
            {
                changes += string.Format("\nSALE PRICE changed FROM '{0}' TO '{1}'", x.Price.SalePrice, y.Price.SalePrice);
            }

            if (x.Price.IsOnSale != y.Price.IsOnSale)
            {
                changes += string.Format("\nIS ON SALE changed FROM '{0}' TO '{1}'", x.Price.IsOnSale, y.Price.IsOnSale);
            }


            if (x.Quantity.Total != y.Quantity.Total)
            {
                changes += string.Format("\nQUANTITY TOTAL changed FROM '{0}' TO '{1}'", x.Quantity.Total, y.Quantity.Total);
            }

            if (x.Quantity.Today != y.Quantity.Today)
            {
                changes += string.Format("\nQUANTITY TODAY changed FROM '{0}' TO '{1}'", x.Quantity.Today, y.Quantity.Today);
            }

            if (x.Quantity.Weekly != y.Quantity.Weekly)
            {
                changes += string.Format("\nQUANTITY WEEKLY changed FROM '{0}' TO '{1}'", x.Quantity.Weekly, y.Quantity.Weekly);
            }

            if (x.Quantity.Monthly != y.Quantity.Monthly)
            {
                changes += string.Format("\nQUANTITY MONTHLY changed FROM '{0}' TO '{1}'", x.Quantity.Monthly, y.Quantity.Monthly);
            }

            if (x.Quantity.Annually != y.Quantity.Annually)
            {
                changes += string.Format("\nQUANTITY ANNUALLY changed FROM '{0}' TO '{1}'", x.Quantity.Annually, y.Quantity.Annually);
            }

            if (x.Quantity.UsedTotal != y.Quantity.UsedTotal)
            {
                changes += string.Format("\nQUANTITY USED TOTAL changed FROM '{0}' TO '{1}'", x.Quantity.UsedTotal, y.Quantity.UsedTotal);
            }

            return(changes);
        }