/// <summary>
 /// Handles Delete of an item
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolBtnDelete_Click(object sender, EventArgs e)
 {
     DataRow drv = gridView1.GetFocusedDataRow();
     if (drv != null)
     {
         Items itm = new Items();
         ProductsCategory proCat = new ProductsCategory();
         int itemId = Convert.ToInt32(drv["ID"]);
         if (!itm.HasTransactions(itemId))
         {
             if (XtraMessageBox.Show("Are You Sure, You want to delete this Transaction? You will not be able to restore this data.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 proCat.GetCategoryByItem(itemId);
                 foreach (DataRowView drcat in proCat.DefaultView)
                 {
                     ProductsCategory cat = new ProductsCategory();
                     cat.LoadByPrimaryKey(Convert.ToInt32(drcat["ID"]));
                     cat.MarkAsDeleted();
                     cat.Save();
                 }
                 itm.LoadByPrimaryKey(itemId);
                 itm.MarkAsDeleted();
                 itm.Save();
                 XtraMessageBox.Show("Item Deleted!","Confirmation",MessageBoxButtons.OK,MessageBoxIcon.Information);
             }
         }
         else
         {
             XtraMessageBox.Show("Unable to Delete, This Item has been Received or Issued.", "Unable to Delete", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
 }
        private void PopulateFields()
        {
            if (_itemId == 0) return;

            Items itm = new Items();

            itm.LoadByPrimaryKey(_itemId);
            cboIIN.EditValue = itm.IINID;
            INN nInn = new INN();
            nInn.LoadByPrimaryKey(itm.IINID);
            txtStrength.Text = itm.Strength;
            cboDosageForm.EditValue = itm.DosageFormID;
            cboUnit.EditValue = itm.UnitID;
            string code = itm.StockCode;
            txtStockCode.Text = code;
            ckNeedExp.Checked = itm.NeedExpiryBatch;

            if (itm.HasTransactions(_itemId))
                ckNeedExp.Enabled = false;
        }