Ejemplo n.º 1
0
        private void btThoat_Click(object sender, EventArgs e)
        {
            this.Close();
            FormNhanVien nv = new FormNhanVien();

            nv.ShowDialog();
        }
Ejemplo n.º 2
0
        private void nhânViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormNhanVien frnv = new FormNhanVien();

            frnv.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        private void btnnhanvien_Click(object sender, EventArgs e)
        {
            FormNhanVien frnv = new FormNhanVien();

            frnv.Show();
            this.Hide();
        }
Ejemplo n.º 4
0
        private void btLuu_Click(object sender, EventArgs e)
        {
            if (isEmpty())
            {
                return;
            }
            nv = new NhanVien_obj();
            //try
            //{
            if (datetimeNgaySinh.Value < DateTime.Today)
            {
                nv.ngaysinhNV = datetimeNgaySinh.Value;
                nv.IDNV       = txtID.Text;
                nv.hotenNV    = txtHoten.Text;



                if (rdbNam.Checked == true)
                {
                    nv.gioitinhNV = true;
                }
                else if (rdbNu.Checked == true)
                {
                    nv.gioitinhNV = false;
                }
                nv.quequanNV   = txtQuequan.Text;
                nv.diachiNV    = txtDiachi.Text;
                nv.emailNV     = txtEmail.Text;
                nv.dienthoaiNV = txtDienthoai.Text;
                nv.soCMNDNV    = txtCMND.Text;
                nv.PB_IDNV     = cmbTenPhongBan.SelectedValue.ToString();
                nv.CV_IDNV     = cmbChucVu.SelectedValue.ToString();


                NhanVienBus bus = new NhanVienBus();
                int         ret;
                ret = bus.insert(nv);
                bus.close();
                if (ret < 0)
                {
                    MessageBox.Show("Dữ liệu không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                    //this.Hide();
                    //FormNhanVien nv = new FormNhanVien();
                    //nv.Show();
                }
                else
                {
                    MessageBox.Show("Thêm mới thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (MessageBox.Show("Bạn có muốn tiếp tục thêm mới?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        txtID.Clear();
                        txtHoten.Clear();
                        txtEmail.Clear();
                        txtDienthoai.Clear();
                        txtDiachi.Clear();
                        txtCMND.Clear();
                        txtQuequan.Clear();
                        cmbChucVu.Text      = "";
                        cmbTenPhongBan.Text = "";
                        return;
                    }
                    this.Hide();
                    FormNhanVien nv = new FormNhanVien();
                    nv.Show();
                }
            }
            else
            {
                MessageBox.Show("Nhập sai ngày!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("Dữ liệu không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}
        }