Exemple #1
0
 public SupportListWithTotal GetSupportList()
 {
     SupportListWithTotal splt = new SupportListWithTotal();
     conn.Open();
     cmd.CommandText = "select count(supportID) from supportTB ";
     splt.total = Convert.ToInt32(cmd.ExecuteScalar());
     cmd.CommandText = "select supportID , supportTitle from supportTB order by supportID";
     dr = cmd.ExecuteReader();
     List<Support> spl = new List<Support>();
     while (dr.Read())
     {
         Support sp = new Support();
         sp.supportID = Convert.ToInt32(dr["supportID"]);
         sp.supportTitle = dr["supportTitle"].ToString();
         spl.Add(sp);
     }
     splt.rows = spl;
     conn.Close();
     return splt;
 }
Exemple #2
0
 public void SaveSupport(Support spt)
 {
     conn.Open();
     cmd.CommandText = "update  supportTB set supportContent=@supportContent   where supportID=@supportID";
     cmd.Parameters.AddWithValue("@supportContent", spt.supportContent);
     cmd.Parameters.AddWithValue("@supportID", spt.supportID);
     cmd.ExecuteNonQuery();
     conn.Close();
 }
Exemple #3
0
 public Support GetSupport(int id)
 {
     Support sp = new Support();
     conn.Open();
     cmd.CommandText = "select * from supportTB where supportID= "+id.ToString();
     dr = cmd.ExecuteReader();
     if (dr.Read())
     {
         sp.supportID = Convert.ToInt32(dr["supportID"]);
         sp.supportTitle = dr["supportTitle"].ToString();
         sp.supportContent = dr["supportContent"].ToString();
     }
     conn.Close();
     return sp;
 }