Пример #1
0
        public bool Insert(DataGridView dataGrid, string MaDG, string MaLoaiDG, string HoTen, string NgaySinh, string DiaChi,
                           string Email, string NgayLapThe, string SoSachMuon, string TinhTrang)
        {
            try
            {
                Models.DocGia docGia = new Models.DocGia()
                {
                    MaDG            = MaDG.Trim(),
                    MaLoaiDG        = MaLoaiDG.Trim(),
                    HoTen           = HoTen.Trim(),
                    NgaySinh        = NgaySinh.Trim(),
                    DiaChi          = DiaChi.Trim(),
                    Email           = Email.Trim(),
                    NgayLapThe      = NgayLapThe,
                    SoSachMuon      = int.Parse(SoSachMuon),
                    TinhTrangTraTre = TinhTrang,
                };

                string[] parameters = { "MaDG", "MaLoaiDG", "HoTen", "NgaySinh", "DiaChi", "Email", "NgayLapThe", "SoSachMuon",
                                        "TinhTrangTraTre" };
                string[] values = { docGia.MaDG,       docGia.MaLoaiDG,              docGia.HoTen, docGia.NgaySinh, docGia.DiaChi, docGia.Email,
                                    docGia.NgayLapThe, docGia.SoSachMuon.ToString(), docGia.TinhTrangTraTre };
                MSS.crud.Insert("DOCGIA", parameters, values);
                GetAllDocGia(dataGrid);
                return(true);
            }
            catch (Exception err)
            {
                Utils.MSG(err.Message);
                return(false);
            }
        }
Пример #2
0
 public bool Delete(DataGridView dataGrid, string MaDG)
 {
     try
     {
         Models.DocGia docGia = new Models.DocGia()
         {
             MaDG = MaDG,
         };
         string[] where = { "MaDG" };
         string[] whereValues = { docGia.MaDG };
         MSS.crud.Delete("DOCGIA", where, whereValues);
         GetAllDocGia(dataGrid);
         return(true);
     }
     catch (Exception err)
     {
         Utils.MSG(err.Message);
         return(false);
     }
 }