Beispiel #1
0
 public int Update(VoteArticleQuery m)
 {
     StringBuilder str = new StringBuilder();
     m.Replace4MySQL();
     try
     {
         str.AppendFormat("update vote_article SET user_id='{0}',article_content='{1}',article_title='{2}',product_id='{3}',prod_link='{4}'  ", m.user_id, m.article_content, m.article_title, m.product_id,m.prod_link);
         str.AppendFormat(",article_banner='{0}',update_time='{1}',update_user='******'", m.article_banner, CommonFunction.DateTimeToString(m.update_time), m.update_user);
         str.AppendFormat(",event_id='{0}',vote_count='{1}',article_sort='{2}', article_start_time='{3}', article_end_time='{4}',article_show_start_time='{5}',article_show_end_time='{6}'   WHERE article_id='{7}';", m.event_id, m.vote_count, m.article_sort, CommonFunction.DateTimeToString(m.article_start_time), CommonFunction.DateTimeToString(m.article_end_time), CommonFunction.DateTimeToString(m.article_show_start_time), CommonFunction.DateTimeToString(m.article_show_end_time), m.article_id);
         return _access.execCommand(str.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" VoteArticleDao-->Update-->" + ex.Message + "sql:" + str.ToString(), ex);
     }
 }
Beispiel #2
0
 public int UpdateStatus(VoteArticleQuery m)
 {//變更狀態
     StringBuilder str = new StringBuilder();
     try
     {
         m.Replace4MySQL();
         if (m.article_id > 0)
         {
             str.Append("set sql_safe_updates=0;");
             str.AppendFormat("Update vote_article SET article_status='{0}',update_time='{1}',update_user='******' where article_id='{3}';", m.article_status, CommonFunction.DateTimeToString(m.update_time), m.update_user, m.article_id);
             str.Append("set sql_safe_updates=1;");
             //添加修改message表所有狀態
             return _access.execCommand(str.ToString());
         }
         else
         {
             return 0;
         }
     }
     catch (Exception ex)
     {
         throw new Exception(" VoteArticleDao-->UpdateStatus-->" + ex.Message + "sql:" + str.ToString(), ex);
     }
 }
Beispiel #3
0
 public int Save(VoteArticleQuery m)
 {
     StringBuilder str = new StringBuilder();
     m.Replace4MySQL();
     try
     {
         m.Replace4MySQL();
         str.AppendFormat("insert into vote_article (event_id,user_id,article_content,article_status,article_title,article_banner,create_user,create_time,update_time,update_user,product_id,vote_count,article_sort,prod_link,article_start_time,article_end_time,article_show_start_time,article_show_end_time) Value('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')", m.event_id, m.user_id, m.article_content, m.article_status, m.article_title, m.article_banner, m.create_user, CommonFunction.DateTimeToString(m.create_time), CommonFunction.DateTimeToString(m.update_time), m.update_user, m.product_id, m.vote_count, m.article_sort, m.prod_link, CommonFunction.DateTimeToString(m.article_start_time),CommonFunction.DateTimeToString(m.article_end_time),  CommonFunction.DateTimeToString(m.article_show_start_time),CommonFunction.DateTimeToString(m.article_show_end_time));
         return _access.execCommand(str.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception(" VoteArticleDao-->Save-->" + ex.Message + "sql:"+ str.ToString(), ex);
     }
 }