Example #1
0
 public int InsertLop(Lop lop)
 {
     try
     {
         DB.Lops.InsertOnSubmit(lop);
         DB.SubmitChanges();
     }
     catch (Exception e)
     {
         return(-1);
     }
     return(1);
 }
Example #2
0
 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);
 }
Example #3
0
 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");
     }
 }
Example #4
0
        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);
        }
Example #5
0
 public bool EditLop(Lop lop)
 {
     return(objLop.EditLop(lop));
 }
Example #6
0
 public bool AddLop(Lop l)
 {
     return(objLop.AddLop(l));
 }
Example #7
0
        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 }));
        }
Example #8
0
        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 }));
        }
Example #9
0
 public bool Update(Lop lop)
 {
     return(lopDTL.Update(lop) > 0);
 }
Example #10
0
 public bool Insert(Lop lop)
 {
     return(lopDTL.Insert(lop) > 0);
 }