示例#1
0
        protected override bool Save(object parameter)
        {
            log.Debug("Save " + ItemName);

            bool result = false;

            if (NewRecord)
            {
                result = ManagePartners.NewPartner(Item);
            }
            else
            {
                result = ManagePartners.ModifyPartner(Item);
            }
            return(result);
        }
示例#2
0
        protected override void DeleteItem(object parameter)
        {
            log.Debug("Delete " + ItemName + " button");

            string name = SelectedItem.Name;

            if (ManagePartners.DeletePartner(SelectedItem))
            {
                RefreshList(parameter);
                NotificationProvider.Info("Partner deleted", string.Format("Partner name:{0}", name));
            }
            else
            {
                NotificationProvider.Error("Delete partner error", "This partner is set to one or more transactions.");
            }
        }
        // Constructor
        public EditTransactionViewModel(TransactionHeadListEntity item, bool newRecord, string itemName) : base(item, newRecord, itemName)
        {
            TransactionDate = Item.Head.Date;

            this.TransactionBody.CollectionChanged += this.OnCollectionChanged;
            if (Item.Head.Id > 0)
            {
                var list = ManageTransactions.ListBody(Item.Head.Id);
                foreach (var record in list)
                {
                    TransactionBody.Add(new BindableTransactionBodyListEntity(record));
                }
            }

            if (Item.Head.Incoming)
            {
                Partners = ManagePartners.ListDealers();
            }
            else
            {
                Partners = ManagePartners.ListCustomers();
            }
            if (Item.Partner != null)
            {
                foreach (var record in Partners.Where(p => p.Id == Item.Partner.Id))
                {
                    SelectedPartner = record;
                }
            }

            SelectedProductCategory = new ProductCategoryEntity()
            {
                Category = " - All product categories - ", Id = 0
            };
            ProductCategories.Add(SelectedProductCategory);

            ProductCategories.AddRange(ManageProducts.ListProductCategories());
        }
示例#4
0
        protected override void RefreshList(object parameter)
        {
            log.Debug("Refresh " + ItemName + " list");

            List = ManagePartners.ListPartners();
        }