Пример #1
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model">VoteDetail對象</param>
 /// <returns>更新結果</returns>
 public int Update(VoteDetail model)
 {
     try
     {
         return _voteDetailDao.Update(model);
     }
     catch (Exception ex)
     {
         throw new Exception("VoteDetailMgr-->Update-->" + ex.Message, ex);
     }
 }
Пример #2
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">VoteDetail對象</param>
 /// <returns>新增后的標識</returns>
 public int Add(VoteDetail model)
 {
     try
     {
        return _voteDetailDao.Add(model);
     }
     catch (Exception ex)
     {
         throw new Exception("VoteDetailMgr-->Add-->" + ex.Message, ex);
     }
 }
Пример #3
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="model">VoteDetail對象</param>
 /// <returns>更新結果</returns>
 public int Update(VoteDetail model)
 {
     int result = 0;
     StringBuilder sbSql = new StringBuilder();
     model.Replace4MySQL();
     sbSql.Append("set sql_safe_updates=0;");
     sbSql.AppendFormat("UPDATE vote_detail set article_id='{0}',user_id='{1}',ip='{2}',create_user='******',update_user='******',create_time='{5}',update_time='{6}' WHERE vote_id='{7}';", model.article_id, model.user_id, model.ip, model.create_user, model.update_user, CommonFunction.DateTimeToString(model.create_time), CommonFunction.DateTimeToString(model.update_time), model.vote_id);
     sbSql.Append("set sql_safe_updates=1;");
     try
     {
         result = _access.execCommand(sbSql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("VoteDetailDao-->Update-->" + ex.Message + sbSql.ToString(), ex);
     }
     return result;
 } 
Пример #4
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="model">VoteDetail對象</param>
 /// <returns>新增后的標識</returns>
 public int Add(VoteDetail model)
 {
     StringBuilder sbSql = new StringBuilder();
     model.Replace4MySQL();
     sbSql.Append("INSERT INTO vote_detail(article_id,user_id,ip,vote_status,create_user,update_user,create_time,update_time) ");
     sbSql.AppendFormat(" VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');SELECT @@IDENTITY;", model.article_id, model.user_id, model.ip, model.vote_status, model.create_user, model.update_user, CommonFunction.DateTimeToString(model.create_time), CommonFunction.DateTimeToString(model.update_time));
     try
     {
         DataTable _dt = _access.getDataTable(sbSql.ToString());
         if (_dt.Rows.Count > 0)
         {
             return Convert.ToInt32(_dt.Rows[0][0]);
         }
         else
         {
             return 0;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("VoteDetailDao-->Add-->" + ex.Message + sbSql.ToString(), ex);
     }
 } 
Пример #5
0
 /// <summary>
 /// 通過id獲取VoteDetail對象
 /// </summary>
 /// <param name="vote_id">編號</param>
 /// <returns>VoteDetail對象</returns>
 public VoteDetail Get(int vote_id)
 {
     VoteDetail model = new VoteDetail();
     string sql = "SELECT vote_id,article_id,user_id,ip,vote_status,create_user,update_user,create_time,update_time FROM vote_detail WHERE vote_id=" + vote_id;
     try
     {
         model = _access.getSinggleObj<VoteDetail>(sql);
     }
     catch (Exception ex)
     {
         throw new Exception("VoteDetailDao-->Get-->" + ex.Message + sql, ex);
     }
     return model;
 }