private void MayBomBtn_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <MayBomForm>().Count() == 1) { Application.OpenForms.OfType <MayBomForm>().First().Focus(); } else { var form = new MayBomForm(); form.Show(); } }
public SuaMayBom(MayBomForm form, string id) : this() { this.parentForm = form; try { var db = new CkpEntities(); var mayBom = (from b in db.MayBom where b.Id == id select b).First(); IdTbox.Text = mayBom.Id; NameTBox.Text = mayBom.TenBom; TypeCBox.Text = mayBom.LoaiBom == 1 ? "Bơm công ty" : "Bơm thuê ngoài"; } catch (Exception ex) { MessageBox.Show(ex.GetBaseException().Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ThemMayBom(MayBomForm form) : this() { parentForm = form; }