Ejemplo n.º 1
0
 public bool GetGrd(int id)
 {
     dalBase.sql = "SELECT * FROM db_grade WHERE grdid=@grdid";
     dalBase.Param = new MySqlParameter("@grdid", id);
     if (dalBase.Run(Behavious.SELECT_WITH_SINGLEPARAM, false))
     {
         grdInfo = new Grade()
         {
             ID = Convert.ToInt32(dalBase.DataRead["grdid"]),
             Name = dalBase.DataRead["grdname"].ToString()
         };
         dalBase.CloseConnect();
         return true;
     }
     else
     {
         dalBase.CloseConnect();
         return false;
     }
 }
Ejemplo n.º 2
0
 public bool GetGrds()
 {
     dalBase.sql = "SELECT * FROM db_grade";
     if (dalBase.Run(Behavious.SELECT_WITHOUT_PARAM, false))
     {
         while (dalBase.DataRead.Read())
         {
             grdInfo = new Grade()
             {
                 ID = Convert.ToInt32(dalBase.DataRead["grdid"]),
                 Name = dalBase.DataRead["grdname"].ToString()
             };
             list_GrdInfo.Add(grdInfo);
         }
         dalBase.CloseConnect();
         return true;
     }
     else
     {
         dalBase.CloseConnect();
         return false;
     }
 }
Ejemplo n.º 3
0
 public bool UpdateGrd(Grade grd)
 {
     dalBase.sql = "UPDATE db_grade SET grdname=@grdname WHERE grdid=@grdid";
     dalBase.List_param = new List<MySqlParameter>()
     {
         new MySqlParameter("@grdname", grd.Name),
         new MySqlParameter("@grdid", grd.ID)
     };
     return dalBase.Run(Behavious.INSERT_OR_UPDATE_OR_DELETE, true);
 }
Ejemplo n.º 4
0
 public bool InsertGrd(Grade grd)
 {
     dalBase.sql = "INSERT INTO db_grade VALUES (@grdname)";
     dalBase.Param = new MySqlParameter("@grdname", grd.Name);
     return dalBase.Run(Behavious.INSERT_OR_UPDATE_OR_DELETE, true);
 }