Dispose() public method

public Dispose ( ) : void
return void
Exemplo n.º 1
0
 public static String GetTopicAnswer(int TopicId)
 {
     String commStr = "select * from Answer where TopicId = " + TopicId;
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 2
0
 public static bool CancelRecommandAnswer(int id)
 {
     String commStr = "update Answer set Recommand = 0 where id = " + id;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 3
0
 public static bool DeleteFocusPart(String UserName, String Part)
 {
     String commStr = "update Users set FocusPart = '" + GetMessage(UserName, "FocusPart").Replace(Part+",","") + "' where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 4
0
 public static String GetRecommandAnswer()
 {
     String commStr = "select * from Answer where Recommand = 1";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 5
0
 public static String GetUserTopic(String Author)
 {
     String commStr = "select * from Topic where Author = '" + Author + "'";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 6
0
 public static String GetRecommandTopic(String Part)
 {
     String commStr = "select * from Topic where Recommand = 1 and Part in ('" + Part.Substring(0,Part.Length-1).Replace(",","','") + "')";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 7
0
 public static bool ModifyMessage(int TopicId, String key, String values)
 {
     String commStr = "update Topic set " + key + " = '" + values + "' where id = " + TopicId;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 8
0
 public static bool DeleteTopic(int TopicId)
 {
     String commStr = "delete from Topic where id = "+TopicId;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 9
0
 public static String GetPartTopic(String Part)
 {
     String commStr = "select * from Topic where Part = '" + Part + "'";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 10
0
 public static String GetAllRecommandTopic()
 {
     String commStr = "select * from Topic where Recommand = 1";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 11
0
 public static bool AddPoint(String UserName, int Point)
 {
     String commStr = "update Users set AccumulatePoint = " + (int.Parse(GetMessage(UserName, "AccumulatePoint"))+Point) + " where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 12
0
 public static bool DeleteAnswer(int id)
 {
     String commStr = "delete from Answer where id = " + id;
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 13
0
 public static String GetXml(int id)
 {
     String commStr = "select * from Topic where id = " + id;
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 14
0
 public static bool ModifyMessage(String UserName,String key,String values)
 {
     String commStr = "update Users set " + key + " = '" + values + "' where UserName = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 15
0
 public static bool Login(String UserName,String Password)
 {
     String commStr = "select * from Users where UserName = '******' and Password = '******'";
     SQL sql = new SQL();
     bool f = sql.ExecuteReader(commStr).Read();
     sql.Dispose();
     return f;
 }
Exemplo n.º 16
0
 public static String GetXml(String UserName)
 {
     String commStr = "select UserName,Email,StudentNumber,Major,AccumulatePoint,FocusPart from Users where UserName = '******'";
     SQL sql = new SQL();
     String ans = sql.ExecuteXml(commStr);
     sql.Dispose();
     return ans;
 }
Exemplo n.º 17
0
 public static String GetMessage(int id, String key)
 {
     String ans = "";
     String commStr = "select " + key + " from Topic where id = " + id;
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr);
     if (r == null)
         return ans;
     if (r.Read())
         ans += r[0].ToString();
     r.Close();
     sql.Dispose();
     return ans;
 }
Exemplo n.º 18
0
 public static String GetMessage(String UserName,String key)
 {
     String ans = "";
     String commStr = "select " + key + " from Users where UserName = '******'";
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr);
     if(r==null)
         return ans;
     if (r.Read())
         ans += r[0].ToString();
     r.Close();
     sql.Dispose();
     return ans;
 }
Exemplo n.º 19
0
 public static int PostTopic(String Author,String Title,String Part,String Text)
 {
     String commStr1 = "select max(id) as lastId from Topic";
     SQL sql = new SQL();
     SqlDataReader r = sql.ExecuteReader(commStr1);
     int id = 0;
     if(r.Read())
         id = int.Parse(r[0].ToString())+1;
     r.Close();
     String date = DateTime.Now.ToShortDateString();
     String commStr2 = "insert into Topic values (" + id + ",'" + Author + "','" + date + "','"+ Title + "','" + Part + "','" + Text + "')";
     sql.ExecuteNonQuery(commStr2);
     sql.Dispose();
     return id;
 }
Exemplo n.º 20
0
 public static bool Register(String UserName,String Password)
 {
     String commStr = "insert into Users values ('" + UserName + "','" + Password + "','','','',0,'')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 21
0
 public static bool PostTopic(String Author,String Title,String Part,String Text)
 {
     String commStr = "insert into Topic (Author,Date,Title,Part,Text) values ('" + Author + "',getdate(),'"+ Title + "','" + Part + "','" + Text + "')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }
Exemplo n.º 22
0
 public static bool PostAnswer(int TopicId,String Author,String Text)
 {
     String commStr = "insert into Answer(TopicId,Author,Date,Text) values (" + TopicId + ",'" + Author + "',getdate(),'" + Text + "')";
     SQL sql = new SQL();
     bool f = sql.ExecuteNonQuery(commStr);
     sql.Dispose();
     return f;
 }