Exemple #1
0
        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");
                }
            }
        }
Exemple #2
0
        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");
                }
            }
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 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));
 }
Exemple #5
0
        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();
        }
Exemple #6
0
 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));
 }
Exemple #7
0
 public void ThemTT(Thuthu tt)
 {
     if (!string.IsNullOrEmpty(tt.TenThuThu))
     {
         ttDA.ThemTT(tt);
     }
     else
     {
         throw new Exception("Du lieu sai");
     }
 }
Exemple #8
0
 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));
 }
Exemple #9
0
        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);
        }
Exemple #10
0
        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");
            }
        }
Exemple #11
0
 public static int DeleteProfile(Thuthu tt)
 {
     return(Dao.DeleteProfile(tt));
 }
Exemple #12
0
 public static int UpdateProfile(Thuthu tt)
 {
     return(Dao.UpdateProfile(tt));
 }
Exemple #13
0
 public static int InsertProfile(Thuthu tt)
 {
     return(Dao.InsertProfile(tt));
 }