Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (StringTools.TrimSpace(editName.Text).Length <= 0)
            {
                errorProvider.SetError(editName, "Trường tin Tên lái xe bắt buộc phải nhập");
                editName.Focus();
                return;
            }
            string SoThe = StringTools.TrimSpace(editSoTheLaiXe.Text);

            if (IsAdd && (SoThe.Length > 0) && (NhanVien.CheckTheLaiXeTonTai(SoThe)))
            {
                new MessageBox.MessageBoxBA().Show("Mã thẻ lái xe đã tồn tại.Bạn cần kiểm tra lại.");
                this.DialogResult = DialogResult.Cancel;
                return;
            }
            // Kiểm tra số điện thoại di động
            string Phones = StringTools.TrimSpace(editDiDong.Text);

            if (this.CheckTrungTrongChinhMinh(Phones))
            {
                new MessageBox.MessageBoxBA().Show("Bạn nhập số điện thoại trùng nhau cần kiểm tra lại.");
                this.DialogResult = DialogResult.Cancel;
                return;
            }
            string MessageTrung = "";

            if (this.CheckTonTaiSoDienThoai(IsAdd, Phones, mNhanVien, out MessageTrung))
            {
                new MessageBox.MessageBoxBA().Show("Số điện thoại bạn nhập đã trùng với số trước đố đã nhập.[" + MessageTrung + "]");
                this.DialogResult = DialogResult.Cancel;

                return;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }