public ItemCreateForm() { InitializeComponent(); // this.AcceptButton=savebutton; itemCreatelabel.Visible = false; InventoryCategoryBLL aBlll=new InventoryCategoryBLL(); List<InventoryCategory> aaList=new List<InventoryCategory>(); aaList = aBlll.GetAllCategory(); categoryNamecomboBox.DataSource = aaList; categoryNamecomboBox.DisplayMember = "CategoryName"; categoryNamecomboBox.ValueMember = "CategoryId"; UnitCreateBLL aBll = new UnitCreateBLL(); List<Unit> aList = new List<Unit>(); aList = aBll.GetALLUnit(); unitNamecomboBox.DataSource = aList; unitNamecomboBox.DisplayMember = "UnitName"; unitNamecomboBox.ValueMember = "UnitId"; }
private void unitButton_Click(object sender, EventArgs e) { string sr = string.Empty; sr = unitTextBox.Text; if(sr!="") { Unit aUnit=new Unit(); aUnit.UnitName = sr; UnitCreateBLL aBll=new UnitCreateBLL(); bool check = aBll.CheckExit(sr); if (!check) { unitCreatelabel.Visible = true; unitCreatelabel.Text = aBll.InsertUnit(aUnit); unitTextBox.Clear(); } else MessageBox.Show("Unit Already Exit"); } else MessageBox.Show("Please Check Your Input"); }
private void categoryNamecomboBox_SelectedIndexChanged(object sender, EventArgs e) { try { if (Convert.ToInt32(categoryNamecomboBox.SelectedValue) > 0) { InventoryItemBLL aBll = new InventoryItemBLL(); List<InventoryItem> aList = new List<InventoryItem>(); Int32 category = Convert.ToInt32(categoryNamecomboBox.SelectedValue); InventoryCategory aInventoryCategory =(InventoryCategory) categoryNamecomboBox.Items[categoryNamecomboBox.SelectedIndex]; UnitCreateBLL aCreateBll = new UnitCreateBLL(); //Unit aUnit = new Unit(); //aUnit = aCreateBll.GetUnitByUnitId(aInventoryCategory.UnitId); //unittypelabel.Text = aUnit.UnitName; aList = aBll.GetItemByCategory(category); itemNamecomboBox.DataSource = aList; itemNamecomboBox.DisplayMember = "ItemName"; itemNamecomboBox.ValueMember = "ItemId"; if (Convert.ToInt32(itemNamecomboBox.SelectedValue) > 0) { InventoryItem aItem = new InventoryItem(); aItem = (InventoryItem)itemNamecomboBox.SelectedItem; unittypelabel.Text = aItem.UnitName; } } } catch { } }
private void LoadUnit() { UnitCreateBLL aBll = new UnitCreateBLL(); List<Unit> aList = new List<Unit>(); aList = aBll.GetALLUnit(); unitNamecomboBox.DataSource = aList; unitNamecomboBox.DisplayMember = "UnitName"; unitNamecomboBox.ValueMember = "UnitId"; }