示例#1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     using (var dlg = new EditReceiptItemDialog(currentEditOrder))
     {
         dlg.Text = "Add Receipt Item";
         if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             var index  = receiptItemSource.Add(dlg.Flush());
             var handle = gridViewItems.GetRowHandle(index);
             gridViewItems.MakeRowVisible(handle);
         }
     }
 }
示例#2
0
        private void EditByItem(ReceiptItem item)
        {
            if (item == null)
            {
                return;
            }

            using (var dlg = new EditReceiptItemDialog(currentEditOrder))
            {
                dlg.Text = "Edit Item";
                dlg.Read(item);
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    var index = receiptItemSource.IndexOf(item);
                    receiptItemSource[index] = dlg.Flush();
                }
            }
        }