Esempio n. 1
0
        public void AddNewReceipt()
        {
            var receipt = new Receipt();

            receipt.Date  = DateTime.Today;
            receipt.Items = new ReceiptItem[0];

            using (var dlg = new EditReceiptDialog(receipt, merchantSource, SearchResultID))
            {
                dlg.Text = "Add Receipt";
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    receiptSource.Add(receipt);
                }
            }
        }
Esempio n. 2
0
        public void EditByItem(Receipt receipt)
        {
            if (receipt == null)
            {
                return;
            }

            var copy = receipt.Duplicate();

            using (var dlg = new EditReceiptDialog(copy, merchantSource, SearchResultID))
            {
                dlg.Text = "Edit Receipt";
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    var index = receiptSource.IndexOf(receipt);
                    receiptSource[index] = copy;
                }
            }
        }