private void dgTransactionItems_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dgTransactionItems.SelectedIndex > -1)
            {
                InventoryTransactionItemBinding obj = (InventoryTransactionItemBinding)dgTransactionItems.SelectedCells[0].Item;
                mTransactionItem = (InventoryTransactionItem)mTransactionItems[obj.itemID];
                if (mTransactionItem.GetInventoryItem() == null)
                {
                    try
                    {
                        DataSet data = db.Select("*", InventoryItem.Table, InventoryItem.Fields.itemID.ToString() + " = '" + mTransactionItem.GetItemID() + "'");
                        data.Read();
                        mTransactionItem.SetInventoryItem(new InventoryItem(data.GetRecordDataSet()));

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Loading Item Data - " + msgCodes.GetString("M2102") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                ClearFields();
                SelectedItem();
                lockItemFields();
                txtQuantity.Text = "" + mTransactionItem.GetQuantity();
                cmdSaveEditItem.IsEnabled = true;
                cmdRemoveItem.IsEnabled = true;
                cmdCancelItem.IsEnabled = false;
                cmdSaveEditItem.Content = unlockBtnTxt;
                if (isFormHidden)
                {
                    displayOrHideForm();
                }
            }
        }
 private void selector_ObjectSelected(object sender, RoutedEventArgs e)
 {
     InventoryItem item;
     if (((InventoryItemSelector)sender).SelectedItem != null)
     {
         if (isFormHidden)
         {
             displayOrHideForm();
         }
         item = (InventoryItem)((InventoryItemSelector)sender).SelectedItem;
         ClearFields();
         if (mTransactionItems.ContainsKey(item.getItemID()))
         {
             mTransactionItem = (InventoryTransactionItem)mTransactionItems[item.getItemID()];
             if (mTransactionItem.GetInventoryItem() == null)
             {
                 mTransactionItem.SetInventoryItem(item);
             }
             cmdSaveEditItem.Content = unlockBtnTxt;
             cmdSaveEditItem.IsEnabled = false;
             cmdCancelItem.IsEnabled = false;
             cmdRemoveItem.IsEnabled = true;
         }
         else
         {
             mTransactionItem = new InventoryTransactionItem(mTransaction.GetTransactionID(), item.getItemID());
             mTransactionItem.SetInventoryItem(item);
             mTransactionItems.Add(item.getItemID(), mTransactionItem);
             cmdSaveEditItem.IsEnabled = false;
             cmdCancelItem.IsEnabled = true;
             cmdRemoveItem.IsEnabled = false;
             cmdSaveEditItem.Content = addBtnTxt;
         }
         SelectedItem();
     }
 }