コード例 #1
0
ファイル: frmThemNV.cs プロジェクト: lemanhhuykhmt/QLNS
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            string   ten      = txtHoTen.Text;
            string   gioiTinh = cbGioiTinh.SelectedItem.ToString();
            DateTime ngaySinh = DateTime.Parse(dtpNgaySinh.Text);
            PhongBan pb       = cbPhongBan.SelectedValue as PhongBan;
            int      phong    = pb.MaPB;
            NhanVien nv       = cbNQL.SelectedValue as NhanVien;
            int      nql      = nv.MaNV;
            double   luong    = double.Parse(txtLuong.Text);

            if (kiemTraDuLieu(ten, gioiTinh, ngaySinh, phong, nql, luong))
            {
                int ketqua = NhanVienControl.themDuLieu(ten, ngaySinh, gioiTinh, phong, nql, luong);
                if (ketqua > 0)
                {
                    MessageBox.Show("thêm thành công");
                    txtHoTen.Text   = "";
                    cbGioiTinh.Text = "Lựa chọn giới tính";
                    //txtSDT.Text = "";
                    txtLuong.Text = "";
                }
                else
                {
                    MessageBox.Show("thêm thất bại");
                }
            }
        }
コード例 #2
0
ファイル: frmThemNV.cs プロジェクト: lemanhhuykhmt/QLKS
        private void btnXacNhan_Click(object sender, EventArgs e)
        {
            string   ten      = txtHoTen.Text;
            string   gioiTinh = cbGioiTinh.SelectedItem.ToString();
            DateTime ngaySinh = DateTime.Parse(dtpNgaySinh.Text);
            string   sdt      = txtSDT.Text;
            float    luong    = float.Parse(txtLuong.Text);

            if (kiemTraDuLieu(ten, gioiTinh, ngaySinh, sdt, luong))
            {
                int ketqua = NhanVienControl.themDuLieu(ten, gioiTinh, ngaySinh, sdt, luong);
                if (ketqua > 0)
                {
                    MessageBox.Show("thêm thành công");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("thêm thất bại");
                }
            }
        }