private void btnOK_Click(object sender, EventArgs e) { if (txtManufacturerName.Text == "") { MessageBox.Show("Please enter Manufacturer name!", "Manufacturer"); return; } else { MANUFACTURER_BUS manuBus = new MANUFACTURER_BUS(); List <MANUFACTURER> listManu = manuBus.getDataSource(); foreach (MANUFACTURER m in listManu) { if (m.ManufacturerName == txtManufacturerName.Text) { MessageBox.Show("Manufacturer Name already exist!", "Manufacturer"); return; } } MANUFACTURER ma = new MANUFACTURER(); ma.ManufacturerName = txtManufacturerName.Text; manuBus.add(ma); this.Close(); } }
private void cbManufacturer_Click(object sender, EventArgs e) { if (manu.ButtonOKClicked) { MANUFACTURER_BUS manuBus = new MANUFACTURER_BUS(); List <MANUFACTURER> _manu = manuBus.getDataSource(); cbManufacturer.Properties.Items.Add("", -1, -1); for (int i = 0; i < _manu.Count; i++) { cbManufacturer.Properties.Items.Add(_manu[i].ManufacturerName, i, i); } } }
private void addDatatoControl() { //add site name to combobox listSite = siteBus.getData(); cbSite.Properties.Items.Add("", -1, -1); for (int i = 0; i < listSite.Count; i++) { cbSite.Properties.Items.Add(listSite[i].SiteName, i, i); if (listSite[i].SiteName == siteName) { cbSite.SelectedIndex = i + 1; } } //add facility name to combobox if (this.siteName != null || this.siteName != "") { int _siteID = siteBus.getIDbyName(this.siteName); List <string> _faciName = faciBus.getListFacilityName(_siteID); cbFacility.Properties.Items.Clear(); cbFacility.Properties.Items.Add("", -1, -1); for (int i = 0; i < _faciName.Count; i++) { cbFacility.Properties.Items.Add(_faciName[i], i, i); if (_faciName[i] == facilityName) { cbFacility.SelectedIndex = i + 1; } } } //add equipment type listEquipType = equipType.getDataSource(); cbEquipmentType.Properties.Items.Add("", -1, -1); for (int i = 0; i < listEquipType.Count; i++) { cbEquipmentType.Properties.Items.Add(listEquipType[i].EquipmentTypeName, i, i); } //add manufacturer listManufacture = manuBus.getDataSource(); cbManufacturer.Properties.Items.Add("", -1, -1); for (int i = 0; i < listManufacture.Count; i++) { cbManufacturer.Properties.Items.Add(listManufacture[i].ManufacturerName, i, i); } //add design code listDesignCode = designCodeBus.getDataSource(); cbDesignCode.Properties.Items.Add("", -1, -1); for (int i = 0; i < listDesignCode.Count; i++) { cbDesignCode.Properties.Items.Add(listDesignCode[i].DesignCode, i, i); } }
private void addDatatoControl() { //add site name to combobox listSite = siteBus.getData(); cbSite.Properties.Items.Add("", -1, -1); for (int i = 0; i < listSite.Count; i++) { cbSite.Properties.Items.Add(listSite[i].SiteName, i, i); } //add facility name to combobox cbFacility.Properties.Items.Add("", -1, -1); listFacility = faciBus.getDataSource(); for (int i = 0; i < listFacility.Count; i++) { cbFacility.Properties.Items.Add(listFacility[i].FacilityName, i, i); } //add equipment type listEquipType = equipType.getDataSource(); cbEquipmentType.Properties.Items.Add("", -1, -1); for (int i = 0; i < listEquipType.Count; i++) { cbEquipmentType.Properties.Items.Add(listEquipType[i].EquipmentTypeName, i, i); } //add manufacturer listManufacture = manuBus.getDataSource(); cbManufacturer.Properties.Items.Add("", -1, -1); for (int i = 0; i < listManufacture.Count; i++) { cbManufacturer.Properties.Items.Add(listManufacture[i].ManufacturerName, i, i); } //add design code listDesignCode = designCode.getDataSource(); cbDesignCode.Properties.Items.Add("", -1, -1); for (int i = 0; i < listDesignCode.Count; i++) { cbDesignCode.Properties.Items.Add(listDesignCode[i].DesignCode, i, i); } }