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;
        }
        /// <summary>
        /// Saves INN related info
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnInnSave_Click(object sender, EventArgs e)
        {
            if (txtINN.Text != "")
            {
                INN newInn = new INN();
                if (_innId != 0)
                    newInn.LoadByPrimaryKey(_innId);
                else
                    newInn.AddNew();
                newInn.IIN = txtINN.Text;
                //newInn.ATC = txtATC.Text;
                newInn.Description = txtIINDescription.Text;
                newInn.TypeID = ((rdDrug.Checked) ? 1 : 2);
                newInn.Save();
                newInn.LoadAll();
                PopulateINN(newInn);
                ResetInnForm();
            }
            else
            {
                txtINN.BackColor = Color.FromArgb(251, 214, 214);

            }
        }
        /// <summary>
        /// Handles the selection changed event of the grid product view
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridProductView_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
        {
            DataRow dr = gridProductView.GetFocusedDataRow();
            int selection = Convert.ToInt32(dr["ID"]);

            INN nInn = new INN();
            nInn.LoadByPrimaryKey(selection);
            //txtATC.Text = nInn.ATC;
            txtINN.Text = nInn.IIN;
            txtIINDescription.Text = nInn.Description;
            rdDrug.Checked = ((nInn.TypeID == 1) ? true : false);
            rdSupply.Checked = ((nInn.TypeID == 2) ? true : false);
            _innId = nInn.ID;
            btnInnSave.Text = "Update";
        }
 private void cboIIN_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cboIIN.SelectedValue != null)
     {
         INN getinn = new INN();
         getinn.LoadByPrimaryKey(Convert.ToInt32(cboIIN.SelectedValue));
        // txtATC.Text = getinn.ATC;
     }
 }