public int InsertLop(Lop lop) { try { DB.Lops.InsertOnSubmit(lop); DB.SubmitChanges(); } catch (Exception e) { return(-1); } return(1); }
public int DeleteLop(int malop) { try { Lop lop = DB.Lops.Where(h => h.maLop == malop).FirstOrDefault(); DB.Lops.DeleteOnSubmit(lop); DB.SubmitChanges(); } catch (Exception e) { return(-1); } return(1); }
public string ThemLop(Lop lop) { try { if (_lopDAO.ThemLop(lop) == 1) { return("Đã thêm lớp"); } return("Chưa thêm lớp"); } catch (Exception) { return("Đã bị lỗi"); } }
public List <Lop> Lops() { List <Lop> lops = new List <Lop>(); DataTable dt = DataProvider.Instance.ExcuteQuery(@"select MaLop, TenLop from Lop"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Lop temp = new Lop(); temp.MaLop = dt.Rows[0][0].ToString(); temp.TenLop = dt.Rows[0][1].ToString(); lops.Add(temp); } } return(lops); }
public bool EditLop(Lop lop) { return(objLop.EditLop(lop)); }
public bool AddLop(Lop l) { return(objLop.AddLop(l)); }
public int SuaLop(Lop lop) { string query = @"sb_UpdateClass @malop , @tenlop , @nienkhoa , @siso , @giaovien_cn"; return(DataProvider.Instance.ExcuteNonQuery(query, new object[] { lop.MaLop, lop.TenLop, lop.NienKhoa, lop.SiSo, lop.GiaoVienChuNhiem })); }
public int ThemLop(Lop lop) { string query = @"INSERT INTO [dbo].[Lop] ( [MaLop] ,[TenLop] ,[NienKhoa] ,[SiSo] ,[GiaoVienChuNhiem]) VALUES ( @malop , @tenlop , @nienkhoa , @siso , @giaovienchunhiem )"; return(DataProvider.Instance.ExcuteNonQuery(query, new object[] { lop.MaLop, lop.TenLop, lop.NienKhoa, lop.SiSo, lop.GiaoVienChuNhiem })); }
public bool Update(Lop lop) { return(lopDTL.Update(lop) > 0); }
public bool Insert(Lop lop) { return(lopDTL.Insert(lop) > 0); }