Exemplo n.º 1
0
        //Xóa thông tin cá nhân
        private void btnXoa_Click(object sender, EventArgs e)
        {
            TTCaNhanDTO ttCaNhan = new TTCaNhanDTO();

            ttCaNhan._MaNV      = Convert.ToInt32(txtMaNV.Text);
            ttCaNhan._HoTen     = txtHoTen.Text;
            ttCaNhan._GioiTinh  = comboBox_GioiTinh.Text;
            ttCaNhan._HocVan    = comboBoxHocVan.Text;
            ttCaNhan._HocHam    = comboBoxHocHam.Text;
            ttCaNhan._GhiChu    = txtGhiChu.Text;
            ttCaNhan._QueQuan   = txtQueQuan.Text;
            ttCaNhan._DanToc    = txtDanToc.Text;
            ttCaNhan._SoCMND    = Convert.ToInt32(txtCMND.Text);
            ttCaNhan._SĐT       = Convert.ToInt32(txtSDT.Text);
            ttCaNhan._TonGiao   = txtTonGiao.Text;
            ttCaNhan._TTHonNhan = txtTTHonNhan.Text;
            ttCaNhan._NoiCap    = txtNoiCap.Text;
            ttCaNhan._NgaySinh  = Convert.ToDateTime(dateTimePicker_NgaySinh.Text);
            ttCaNhan._NgayCap   = Convert.ToDateTime(dateTimePicker_NgayCap.Text);

            if (MessageBox.Show("Bạn có muốn xóa không", "Xóa dữ liệu", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                string delete = tTCaNhanBLL.DeleteTTCaNhan(ttCaNhan);
                kn.thucthiketnoi(delete);
                dataGridView_TTCaNhan.Refresh();
                dataGridView_TTCaNhan.DataSource = tTCaNhanBLL.getAllTTCaNhan();
                dataGridView_TTCaNhan.Show();
                MessageBox.Show("Xóa thành công");
            }
        }
Exemplo n.º 2
0
        //Sửa thông tin cá nhân

        private void btnSua_Click(object sender, EventArgs e)
        {
            TTCaNhanDTO ttCaNhan = new TTCaNhanDTO();

            try
            {
                ttCaNhan._MaNV      = Convert.ToInt32(txtMaNV.Text);
                ttCaNhan._HoTen     = txtHoTen.Text;
                ttCaNhan._GioiTinh  = comboBox_GioiTinh.Text;
                ttCaNhan._HocVan    = comboBoxHocVan.Text;
                ttCaNhan._HocHam    = comboBoxHocHam.Text;
                ttCaNhan._GhiChu    = txtGhiChu.Text;
                ttCaNhan._QueQuan   = txtQueQuan.Text;
                ttCaNhan._DanToc    = txtDanToc.Text;
                ttCaNhan._SoCMND    = Convert.ToInt32(txtCMND.Text);
                ttCaNhan._SĐT       = Convert.ToInt32(txtSDT.Text);
                ttCaNhan._TonGiao   = txtTonGiao.Text;
                ttCaNhan._TTHonNhan = txtTTHonNhan.Text;
                ttCaNhan._NoiCap    = txtNoiCap.Text;
                ttCaNhan._NgaySinh  = Convert.ToDateTime(dateTimePicker_NgaySinh.Text);
                ttCaNhan._NgayCap   = Convert.ToDateTime(dateTimePicker_NgayCap.Text);
                string update = tTCaNhanBLL.UpdateTTCaNhan(ttCaNhan);
                kn.thucthiketnoi(update);
                dataGridView_TTCaNhan.Refresh();
                dataGridView_TTCaNhan.DataSource = tTCaNhanBLL.getAllTTCaNhan();
                dataGridView_TTCaNhan.Show();
                MessageBox.Show("Sửa thành công");
            }
            catch
            {
                MessageBox.Show("Dữ liệu đầu vào không đúng");
            }
        }
Exemplo n.º 3
0
        ///-------------------------------------SỦA
        //Sửa thông tin cá nhân
        public string UpdateTTCaNhan(TTCaNhanDTO ttCaNhan)
        {
            string Query = "Update TTCaNhan set HoTen=N'" + ttCaNhan._HoTen + "', NgaySinh='" + ttCaNhan._NgaySinh.ToShortDateString() + "'," +
                           "GioiTinh= N'" + ttCaNhan._GioiTinh + "', QueQuan= N'" + ttCaNhan._QueQuan + "',TTHonNhan=N'" + ttCaNhan._TTHonNhan + "',SoCMND='" + ttCaNhan._SoCMND + "'," +
                           "NgayCap='" + ttCaNhan._NgayCap.ToShortDateString() + "',NoiCap=N'" + ttCaNhan._NoiCap + "',SĐT='" + ttCaNhan._SĐT + "',DanToc=N'" + ttCaNhan._DanToc + "',TonGiao=N'" + ttCaNhan._TonGiao + "'," +
                           "HocVan=N'" + ttCaNhan._HocVan + "',HocHam=N'" + ttCaNhan._HocHam + "',GhiChu=N'" + ttCaNhan._GhiChu + "' where MaNV='" + ttCaNhan._MaNV + "'";

            return(Query);
        }
Exemplo n.º 4
0
        ///-------------------------------------THÊM
        //Thêm Thông tin cá nhân
        public string InsertTTCaNhan(TTCaNhanDTO ttCaNhan)
        {
            string Query = "Insert into TTCaNhan(MaNV, HoTen, NgaySinh,GioiTinh,QueQuan,TTHonNhan,SoCMND, NgayCap,NoiCap,SĐT, DanToc, TonGiao, HocVan, HocHam,GhiChu) " +
                           "values('" + ttCaNhan._MaNV + "', N'" + ttCaNhan._HoTen + "', '" + ttCaNhan._NgaySinh + "'" +
                           ",N'" + ttCaNhan._GioiTinh + "',N'" + ttCaNhan._QueQuan + "',N'" + ttCaNhan._TTHonNhan + "'" +
                           ",'" + ttCaNhan._SoCMND + "','" + ttCaNhan._NgayCap + "',N'" + ttCaNhan._NoiCap + "','" + ttCaNhan._SĐT + "',N'" + ttCaNhan._DanToc + "'" +
                           ",N'" + ttCaNhan._TonGiao + "',N'" + ttCaNhan._HocVan + "',N'" + ttCaNhan._HocHam + "',N'" + ttCaNhan._GhiChu + "')";

            return(Query);
        }
Exemplo n.º 5
0
 //Thêm thông tin cá nhân
 private void buttonThem_Click(object sender, EventArgs e)
 {
     try
     {
         TTCaNhanDTO ttCaNhan = new TTCaNhanDTO();
         ttCaNhan._MaNV      = Convert.ToInt32(txtMaNV.Text);
         ttCaNhan._HoTen     = txtHoTen.Text;
         ttCaNhan._QueQuan   = txtQueQuan.Text;
         ttCaNhan._SoCMND    = Convert.ToInt32(txtCMND.Text);
         ttCaNhan._SĐT       = Convert.ToInt32(txtSDT.Text);
         ttCaNhan._TonGiao   = txtTonGiao.Text;
         ttCaNhan._TTHonNhan = txtTTHonNhan.Text;
         ttCaNhan._NoiCap    = txtNoiCap.Text;
         ttCaNhan._NgaySinh  = Convert.ToDateTime(dateTimePicker_NgaySinh.Text);
         ttCaNhan._NgayCap   = Convert.ToDateTime(dateTimePicker_NgayCap.Text);
         ttCaNhan._GioiTinh  = comboBox_GioiTinh.Text;
         ttCaNhan._HocHam    = comboBoxHocHam.Text;
         ttCaNhan._HocVan    = comboBoxHocVan.Text;
         ttCaNhan._GhiChu    = txtGhiChu.Text;
         ttCaNhan._DanToc    = txtDanToc.Text;
         if (txtMaNV.Text != "" && txtHoTen.Text != "" && txtQueQuan.Text != "" && txtCMND.Text != "" && txtSDT.Text != "" && txtTonGiao.Text != "" && txtTTHonNhan.Text != "" && txtNoiCap.Text != "" && dateTimePicker_NgaySinh.Text != "" && dateTimePicker_NgayCap.Text != "")
         {
             string check = tTCaNhanBLL.InsertTTCaNhan(ttCaNhan);
             // string check = ttCaNhan.InsertPB(phongBanDTO);
             kn.thucthiketnoi(check);
             dataGridView_TTCaNhan.Refresh();
             dataGridView_TTCaNhan.DataSource = tTCaNhanBLL.getAllTTCaNhan();
             dataGridView_TTCaNhan.Show();
             MessageBox.Show("Thêm thành công");
         }
         else
         {
             MessageBox.Show("Các trường không được để trống");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Thêm bị lỗi ! " + ex.Message.ToString(), "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Exemplo n.º 6
0
 //Xóa
 public string DeleteTTCaNhan(TTCaNhanDTO ttcanhan)
 {
     return(tt.DeleteTTCaNhan(ttcanhan));
 }
Exemplo n.º 7
0
 //Sửa
 public string UpdateTTCaNhan(TTCaNhanDTO ttCaNhan)
 {
     return(tt.UpdateTTCaNhan(ttCaNhan));
 }
Exemplo n.º 8
0
 //Thêm
 public string InsertTTCaNhan(TTCaNhanDTO ttCaNhan)
 {
     return(tt.InsertTTCaNhan(ttCaNhan));
 }
Exemplo n.º 9
0
        ///-------------------------------------XÓA
        //Xóa phòng thông tin cá nhân
        public string DeleteTTCaNhan(TTCaNhanDTO ttcanhan)
        {
            string Query = "delete TTCaNhan where MaNV='" + ttcanhan._MaNV + "'";

            return(Query);
        }