private void simpleButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textEditTenTho.Text)) { MessageBox.Show(Resources.NhapPhieuGiaCong_TenThoEmpty, Resources.TitleMessageBox_Error, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(textEditSDT.Text)) { MessageBox.Show(Resources.NhapKhachHang_SDTEmpty, Resources.TitleMessageBox_Error, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(textEditDiaChi.Text)) { MessageBox.Show(Resources.NhapKhachHang_DiaChiEmpty, Resources.TitleMessageBox_Error, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } THO newTho = new THO { TenTho = textEditTenTho.Text, SDT = textEditSDT.Text, DiaChi = textEditDiaChi.Text }; _bulTho.AddNewWorker(newTho); MessageBox.Show(Resources.ThemThanhCong, Resources.TitleMessageBox_ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; ClearForm(); if (!IsMdiChild) { Close(); } }
public SuaTho(int id) { InitializeComponent(); _bulTho = new BUL_Tho(); _tho = _bulTho.GetWorkerById(id); textEditTenTho.Text = _tho.TenTho; textEditDiaChi.Text = _tho.DiaChi; textEditSDT.Text = _tho.SDT; }