private void butxoa_Click(object sender, EventArgs e) { if (txtmatt.Text == "" || txttentt.Text == "") { MessageBox.Show("Chưa chọn thông tin"); return; } Thuthu tt = new Thuthu(); tt.matt = txtmatt.Text; tt.tentt = txttentt.Text; tt.ngaysinh = datengaysinh.Value; tt.diachi = txtdiachi.Text; tt.mags = txtmags.Text; if (MessageBox.Show(string.Format("Xóa thủ thư "), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.DeleteProfile(tt) > 0) { MessageBox.Show("Đã xóa"); thuthu_Load(sender, e); } else { MessageBox.Show("Thông tin chưa được xóa"); } } }
private void butluu_Click(object sender, EventArgs e) { if (txtmatt.Text == "" || txttentt.Text == "") { MessageBox.Show("Chưa nhập đủ thông tin"); return; } Thuthu tt = new Thuthu(); tt.matt = txtmatt.Text; tt.tentt = txttentt.Text; tt.ngaysinh = datengaysinh.Value; tt.diachi = txtdiachi.Text; tt.mags = txtmags.Text; if (MessageBox.Show(string.Format("thêm thủ thư"), "", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (Bus.InsertProfile(tt) > 0) { MessageBox.Show("Đã thêm"); thuthu_Load(sender, e); } else { MessageBox.Show("Mã thủ thư đã tồn tại"); } } }
public void ThemPhieu(PhieuMuon pm, Sach sa, DocGia dg, Thuthu tt) { string maphieu = "PM" + DateTime.Now.ToString("yyMMdd"); StreamWriter fwrite = File.AppendText(txtfile); fwrite.WriteLine(); fwrite.Write(maphieu + "#" + dg.MaDocGia + "#" + sa.MaSach + "#" + pm.SoLuongMuon + "#" + pm.NgayMuon + "#" + pm.ThoiGianMuon + "#" + tt.MaThuThu); fwrite.Close(); }
public static int DeleteProfile(Thuthu tt) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@matt", tt.matt), new SqlParameter("@tentt", tt.tentt) }; return(DataProvider.ExecuteNonQuery("xoathuthu", para)); }
public void ThemTT(Thuthu tt) { string matt = "TT" + DateTime.Now.ToString("yyMMdd"); StreamWriter fwrite = File.AppendText(txtfile); fwrite.WriteLine(); fwrite.Write(matt + "#" + tt.TenThuThu + "#" + tt.NgaySinhThuThu + "#" + tt.GioiTinhThuThu + "#" + tt.DiaChithuthu + "#" + tt.SDTThuThu + "#" + tt.CMNDthuThu); fwrite.Close(); }
public static int UpdateProfile(Thuthu tt) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@matt", tt.matt), new SqlParameter("@ten", tt.tentt), new SqlParameter("@diachi", tt.diachi), }; return(DataProvider.ExecuteNonQuery("suathuthu", para)); }
public void ThemTT(Thuthu tt) { if (!string.IsNullOrEmpty(tt.TenThuThu)) { ttDA.ThemTT(tt); } else { throw new Exception("Du lieu sai"); } }
public static int InsertProfile(Thuthu tt) { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@matt", tt.matt), new SqlParameter("@ten", tt.tentt), new SqlParameter("@ngaysinh", tt.ngaysinh), new SqlParameter("@diachi", tt.diachi), new SqlParameter("@mags", tt.mags) }; return(DataProvider.ExecuteNonQuery("themthuthu", para)); }
public List <Thuthu> TimTT(Thuthu tt) { List <Thuthu> listt = GetAllThuThu(); List <Thuthu> kq = new List <Thuthu>(); if (string.IsNullOrEmpty(tt.MaThuThu) && string.IsNullOrEmpty(tt.TenThuThu) ) { kq = listt; } // Tim theo ten thu thu if (!string.IsNullOrEmpty(tt.TenThuThu)) { for (int i = 0; i < listt.Count; ++i) { if (listt[i].TenThuThu.IndexOf(tt.TenThuThu) >= 0) { kq.Add(new Thuthu(listt[i])); } } } // Tim theo ma thu thu else if (!string.IsNullOrEmpty(tt.MaThuThu)) { for (int i = 0; i < listt.Count; ++i) { if (listt[i].MaThuThu.IndexOf(tt.MaThuThu) >= 0) { kq.Add(new Thuthu(listt[i])); } } } else { kq = null; } return(kq); }
public void SuaTT(Thuthu tt) { int i; List <Thuthu> listt = GetAllThuThu(); for (i = 0; i < listt.Count; ++i) { if (listt[i].MaThuThu == tt.MaThuThu) { break; } } if (i < listt.Count) { listt.RemoveAt(i); listt.Add(tt); ttDA.Update(listt); } else { throw new Exception("Khong ton tai thu thu nay"); } }
public static int DeleteProfile(Thuthu tt) { return(Dao.DeleteProfile(tt)); }
public static int UpdateProfile(Thuthu tt) { return(Dao.UpdateProfile(tt)); }
public static int InsertProfile(Thuthu tt) { return(Dao.InsertProfile(tt)); }