private void AddItem_Load(object sender, EventArgs e)
        {
            DosageForm doFrm = new DosageForm();
            doFrm.GetDosageForSupply();

            doFrm.Sort = "Form";
            cboDosageForm.Properties.DataSource = doFrm.DefaultView;

            Unit un = new Unit();
            un.LoadAll();
            un.Sort = "Unit";
            cboUnit.Properties.DataSource = un.DefaultView;

            Product pInn = new Product();
            pInn.GetInnForSupply();

            pInn.Sort = "IIN";
            cboIIN.Properties.DataSource = pInn.DefaultView;

            //if (categoryId != 0)
            //{
            //    SubCategory cat = new SubCategory();
            //    DataTable dtProd = cat.GetSubCategoryByID(categoryId);
            //    string[] categor = { dtProd.Rows[0]["CategoryName"].ToString(), dtProd.Rows[0]["SubCategoryName"].ToString() };
            //    ListViewItem listCat = new ListViewItem(categor);
            //    listCat.Tag = dtProd.Rows[0]["ID"];
            //    lstCat.Items.Add(listCat);
            //    //txtCatCode.Text = dtProd.Rows[0]["CategoryCode"].ToString() + "-" + dtProd.Rows[0]["SubCategoryCode"].ToString();
            //}
            if(_categoryId == 0)
            {
                PopulateFields();
            }
        }
        /// <summary>
        /// Handles the focused row changed event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridUnit_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            DataRow dr = gridUnit.GetFocusedDataRow();
            int id = Convert.ToInt32(dr["ID"]);

            Unit u = new Unit();
            u.LoadByPrimaryKey(id);
            txtUnit.Text = u.Unit;
            txtUnitDescription.Text = u.Description;
            _unitId = u.ID;
        }
        /// <summary>
        /// Populates lookups and tables
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemSetting_Load(object sender, EventArgs e)
        {
            PopulatePrograms();
            // TAb IIN
            BLL.INN innInfo = new INN();
            innInfo.LoadAll();
            innInfo.Sort = "IIN";
            PopulateINN(innInfo);

            // TAb Category

            BLL.Type type = new BLL.Type();
            type.LoadAll();
            lkCategory.DataSource = type.DefaultView;

            PopulateCategoryTree();
            //unit section
            BLL.Unit uni = new Unit();
            uni.LoadAll();
            lstUnits.DataSource = uni.DefaultView;

            // dosage form section
            DosageForm doForm = new DosageForm();
            doForm.LoadAll();
            doForm.Sort = "Form";
            PopulateDosageForm(doForm);
            //receiving status section
            // PopulateManufacturer();
            //disposal reasons
            DisposalReasons reason = new DisposalReasons();
            reason.LoadAll();
            reason.Sort = "Reason";
            PopulateDisposalReason(reason);
            //location regions zones and woredas
            PopulateLocationTree();
            PopulateSupplyCatTree();

            PopulateBalance();
        }
 /// <summary>
 /// Saves unit info
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnUnitSave_Click(object sender, EventArgs e)
 {
     if (txtUnit.Text != "")
     {
         BLL.Unit uni = new Unit();
         if (_unitId != 0)
             uni.LoadByPrimaryKey(_unitId);
         else
             uni.AddNew();
         uni.Unit = txtUnit.Text;
         uni.Description = txtUnitDescription.Text;
         uni.Save();
         uni.LoadAll();
         lstUnits.DataSource = uni.DefaultView;
         ResetUnit();
     }
     else
     {
         txtUnit.BackColor = Color.FromArgb(251, 214, 214);
     }
 }