private void btnSearchUpdate_Click(object sender, EventArgs e) { try { storedMT = new List <MaterialType>(); if (txtSearchMaterialTypeUpdate.Text != string.Empty) { storedMT = mtbll.GetAll(); foreach (var types in storedMT) { if (types._MaterialType == txtSearchMaterialTypeUpdate.Text) { mt = types; } } txtMaterialTypeIDUpdate.Text = mt.MaterialTypeId.ToString(); txtMaterialTypeUpdate.Text = mt._MaterialType; } else { txtMaterialTypeIDUpdate.Text = "---"; txtMaterialTypeUpdate.Text = string.Empty; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BindMaterialType() { try { materialtypeBllList = new MaterialTypeBLL(); MaterialType mt = new MaterialType(); materialtypeList = materialtypeBllList.GetAll(); if (materialtypeList.Count > 0) { mt = materialtypeList[0]; materialtypeList[0] = new MaterialType() { MaterialTypeId = 0, _MaterialType = "Other", isActive = true }; materialtypeList.Add(mt); comboMaterialType.DataSource = materialtypeList.Where(x => x.isActive == true).ToList(); comboMaterialType.DisplayMember = "_MaterialType"; } else { materialtypeList = new List <MaterialType>(); materialtypeList.Add(new MaterialType() { MaterialTypeId = 0, _MaterialType = "Other" }); comboMaterialType.DataSource = materialtypeList; comboMaterialType.DisplayMember = "_MaterialType"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BindMaterialType(MaterialType materialtype) { try { materialtypeBllList = new MaterialTypeBLL(); MaterialType mt = new MaterialType(); materialtypeList = materialtypeBllList.GetAll(); if (materialtypeList.Count > 0) { mt = materialtypeList[0]; materialtypeList[0] = materialtype; materialtypeList.Add(mt); comboMaterialType.DataSource = materialtypeList.ToList(); comboMaterialType.DisplayMember = "_MaterialType"; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }