//report public static IList <NguoiDanInfo> LayDsNguoiDan() { NguoiDanData m_NDData = new NguoiDanData(); DataTable m_DT = m_NDData.LayDsNguoiDanForReport(); IList <NguoiDanInfo> dS = new List <NguoiDanInfo>(); foreach (DataRow Row in m_DT.Rows) { NguoiDanInfo nd = new NguoiDanInfo(); NgheNghiepInfo nn = new NgheNghiepInfo(); nn.MaNgheNghiep = Convert.ToString(Row["MaNgheNghiep"]); nn.TenNgheNghiep = Convert.ToString(Row["TenNgheNghiep"]); DanTocInfo dt = new DanTocInfo(); dt.MaDanToc = Convert.ToString(Row["MaDanToc"]); dt.TenDanToc = Convert.ToString(Row["TenDanToc"]); TonGiaoInfo tg = new TonGiaoInfo(); tg.MaTonGiao = Convert.ToString(Row["MaTonGiao"]); tg.TenTonGiao = Convert.ToString(Row["TenTonGiao"]); nd.MaNguoiDan = Convert.ToString(Row["MaNguoiDan"]); nd.TenNguoiDan = Convert.ToString(Row["TenNguoiDan"]); nd.GioiTinh = Convert.ToBoolean(Row["GioiTinh"]); nd.NgaySinh = Convert.ToDateTime(Row["NgaySinh"]); nd.MaDanToc = dt; nd.MaTonGiao = tg; nd.MaNgheNghiep = nn; dS.Add(nd); } return(dS); }
public static IList <HocSinhInfo> LayDsHocSinh() { HocSinhData m_HSData = new HocSinhData(); DataTable m_DT = m_HSData.LayDsHocSinhForReport(); IList <HocSinhInfo> dS = new List <HocSinhInfo>(); foreach (DataRow Row in m_DT.Rows) { HocSinhInfo hs = new HocSinhInfo(); NgheNghiepInfo nn = new NgheNghiepInfo(); nn.MaNghe = Convert.ToString(Row["MaNghe"]); nn.TenNghe = Convert.ToString(Row["TenNghe"]); DanTocInfo dt = new DanTocInfo(); dt.MaDanToc = Convert.ToString(Row["MaDanToc"]); dt.TenDanToc = Convert.ToString(Row["TenDanToc"]); TonGiaoInfo tg = new TonGiaoInfo(); tg.MaTonGiao = Convert.ToString(Row["MaTonGiao"]); tg.TenTonGiao = Convert.ToString(Row["TenTonGiao"]); hs.MaHocSinh = Convert.ToString(Row["MaHocSinh"]); hs.HoTen = Convert.ToString(Row["HoTen"]); hs.GioiTinh = Convert.ToBoolean(Row["GioiTinh"]); hs.NgaySinh = Convert.ToDateTime(Row["NgaySinh"]); hs.NoiSinh = Convert.ToString(Row["NoiSinh"]); hs.DanToc = dt; hs.TonGiao = tg; hs.HoTenCha = Convert.ToString(Row["HoTenCha"]); hs.NNghiepCha = nn; hs.HoTenMe = Convert.ToString(Row["HoTenMe"]); hs.NNghiepMe = nn; dS.Add(hs); } return(dS); }
public bool CapNhatNgheNghiep(NgheNghiepInfo nn) { try { SqlCommand s = new SqlCommand("UPDATE NGHENGHIEP SET TENNGHENGHIEP = N'" + nn.TenNgheNghep + "' WHERE MANGHENGHIEP=" + nn.MaNgheNghiep); ser.Load(s); return(true); } catch (Exception e) { e.ToString(); return(false);; } }
public bool ThemNgheNghiep(NgheNghiepInfo nn) { try { SqlCommand s = new SqlCommand("INSERT INTO NGHENGHIEP(MANGHENGHIEP,TENNGHENGHIEP) values(" + nn.MaNgheNghiep.ToString() + ",N'" + nn.TenNgheNghep.ToString() + "')"); ser.Load(s); return(true); } catch (Exception e) { e.ToString(); return(false);; } }
public bool XoaNgheNghiep(NgheNghiepInfo nn) { try { SqlCommand s = new SqlCommand("DELETE NGHENGHIEP where MANGHENGHIEP=" + nn.MaNgheNghiep.ToString()); ser.Load(s); return(true); } catch (Exception e) { e.ToString(); return(false);; } }
private void btnSua_Click(object sender, EventArgs e) { if (!boolSua)//Chua chon { btnSua.Text = "Lưu"; QLKTX.Controller.NgheNghiepCtrl qh = new NgheNghiepCtrl(); txtTen.Enabled = true; btnThem.Enabled = false; btnXoa.Enabled = false; btnKetThuc.Text = "Bỏ qua"; txtTen.Text = ""; txtTen.Focus(); boolSua = true; } else { if (txtTen.Text == "") { MessageBox.Show("Nhập Tên! Nhâp lại", "Luu", MessageBoxButtons.OK); txtTen.Focus(); } else { //Goi ham cap nhat NgheNghiepInfo qh = new NgheNghiepInfo(); qh.MaNgheNghiep = Convert.ToInt32(txtMa.Text); qh.TenNgheNghep = txtTen.Text; //Lưu ctrl.SuaNgheNghiep(qh); ctrl.DataTableToListView(listNgheNghiep); boolSua = false; btnSua.Text = "Sửa"; btnThem.Enabled = true; btnXoa.Enabled = true; btnKetThuc.Text = "Kết thúc"; boolSua = false; } } }
/// <summary> /// Thêm một thân nhân /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnThemThanNhan_Click(object sender, EventArgs e) { if (txtHoTenThanNhan.Text != "" && txtHoTenThanNhan != null) { ListViewItem row = new ListViewItem(); row.Text = Convert.ToString(listDSThanNhan.Items.Count + 1); row.SubItems.Add(txtHoTenThanNhan.Text.ToString()); row.SubItems.Add(cmbQuanHeThanNhan.Text); row.SubItems.Add(cmbNgheNghiepThanNhan.Text); ThanNhanInfo thannhan = new ThanNhanInfo(); thannhan.MaThanNhan = listDSThanNhan.Items.Count + 1; SinhVienInfo sv = new SinhVienInfo(); sv.MaKTX = txtMaKTX.Text; sv.HoTen = txtHoTen.Text; thannhan.SinhVien = sv; thannhan.HoTenThanNhan = row.SubItems[1].Text; QuanHeInfo qh = new QuanHeInfo(); qh.MaQuanHe = (int)cmbQuanHeThanNhan.SelectedValue; qh.TenQuanHe = row.SubItems[2].Text; thannhan.QuanHe = qh; NgheNghiepInfo nn = new NgheNghiepInfo(); nn.MaNgheNghiep = Convert.ToInt32(cmbNgheNghiepThanNhan.SelectedValue); nn.TenNgheNghep = cmbNgheNghiepThanNhan.Text; thannhan.NgheNghiep = nn; row.Tag = thannhan; listDSThanNhan.Items.Add(row); // txtHoTenThanNhan.Text = ""; cmbQuanHeThanNhan.SelectedIndex = 0; cmbNgheNghiepThanNhan.SelectedIndex = 0; } else { MessageBox.Show("Chưa nhập đủ thông tin của Thân nhân", "Thân nhân", MessageBoxButtons.OK); } }
public void DataTableToListView(ListViewEx list) { list.Items.Clear(); DataTable table = data.DSNgheNghiep(); foreach (DataRow r in table.Rows) { ListViewItem item = new ListViewItem(); item.Text = r["MANGHENGHIEP"].ToString(); item.SubItems.Add(r["TENNGHENGHIEP"].ToString()); NgheNghiepInfo qh = new NgheNghiepInfo(); qh.MaNgheNghiep = Convert.ToInt32(r["MANGHENGHIEP"]); qh.TenNgheNghep = r["TENNGHENGHIEP"].ToString(); item.Tag = qh; list.Items.Add(item); } }
public bool SuaNgheNghiep(NgheNghiepInfo nn) { NgheNghiepData qhdt = new NgheNghiepData(); return(qhdt.CapNhatNgheNghiep(nn)); }
public bool XoaNgheNghiep(NgheNghiepInfo nn) { NgheNghiepData qhdt = new NgheNghiepData(); return(qhdt.XoaNgheNghiep(nn)); }