Exemplo n.º 1
0
        public bool update(bangdiem l)
        {
            String query = "update bangdiem set diemthilan1 =" + l.diemthilan1 + "," +
                           "diemthilan2=" + l.diemthilan2 + "," + "sotietnghi=" + l.sotietnghi + ", diemtp=" + l.diemtp + " where masv ='" + l.masv + "' and mamonhoc ='" + l.mamonhoc + "'";

            try {
                SqlCommand cmd = new SqlCommand(query, getConnection());
                cmd.ExecuteNonQuery();
                return(true);
            } catch (Exception e) {
                return(false);
            }
        }
Exemplo n.º 2
0
        public bool delete(bangdiem l)
        {
            String query = "delete bangdiem where masv = '" + l.masv + "' and mamonhoc ='" + l.mamonhoc + "'";

            try {
                SqlCommand cmd = new SqlCommand(query, getConnection());
                cmd.ExecuteNonQuery();
                List <bangdiem> listDiem = searchDiem(l.masv);
                foreach (bangdiem item in listDiem)
                {
                    update(item);
                }
                return(true);
            } catch (Exception e) {
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool insert(bangdiem item)
        {
            String query = "Insert into bangdiem values  ('" + item.masv + "' , N'" + item.mamonhoc + "', " + item.diemtp + " ,"
                           + item.diemthilan1 + ", " + item.diemthilan2 + ", " + "0," + " 0 , 0, 0, 0, 0,0 ," + item.sotietnghi + ",0 " + ");";

            try {
                SqlCommand cmd = new SqlCommand(query, getConnection());
                cmd.ExecuteNonQuery();
                List <bangdiem> listDiem = searchDiem(item.masv);
                foreach (bangdiem i in listDiem)
                {
                    update(i);
                }
                return(true);
            } catch (Exception e) {
                return(false);
            }
        }
Exemplo n.º 4
0
        public List <bangdiem> searchDiem(String search)
        {
            List <bangdiem> list  = new List <bangdiem>();
            String          query = "Select * from bangdiem where masv='" + search + "' or mamonhoc='" + search + "' or trangthai='" + search + "'";

            try {
                SqlCommand    cmd    = new SqlCommand(query, getConnection());
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    bangdiem b = new bangdiem();
                    b.bangdiemIDataReader(reader);
                    list.Add(b);
                }
                reader.Close();
            } catch (Exception e) {
            }
            return(list);
        }
Exemplo n.º 5
0
        public List <bangdiem> getListBangdiem()
        {
            List <bangdiem> list  = new List <bangdiem>();
            String          query = "Select * from bangdiem";

            try
            {
                SqlCommand    cmd    = new SqlCommand(query, getConnection());
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    bangdiem b = new bangdiem();
                    b.bangdiemIDataReader(reader);
                    list.Add(b);
                }
                reader.Close();
            }
            catch (Exception e)
            {
            }
            return(list);
        }