/// <summary> /// 修改一个实体 /// </summary> /// <param name="_entity"></param> /// <returns></returns> public int Update(Models.APP.Message model) { try { SqlParameter[] para = { new SqlParameter("@me_id", model.me_id), new SqlParameter("@m_id", model.m_id), new SqlParameter("@a_id", model.a_id), new SqlParameter("@context", model.context), new SqlParameter("@type", model.type), new SqlParameter("@pic", model.pic), new SqlParameter("@title", model.title), new SqlParameter("@isread", model.isread), new SqlParameter("@createtime", model.createtime), new SqlParameter("@modifytime", model.modifytime), new SqlParameter("@userid", model.userid), new SqlParameter("@muserid", model.muserid) }; StringBuilder cmdText = new StringBuilder(); cmdText.Append(@"UPDATE [App_Message] SET [m_id]=@m_id ,[a_id]=@a_id ,[context]=@context ,[type]=@type ,[pic]=@pic ,[title]=@title ,[isread]=@isread ,[createtime]=@createtime ,[modifytime]=@modifytime ,[userid]=@userid ,[muserid]=@muserid WHERE [me_id]=@me_id" ); return(SqlHelper.ExecuteNonQuery(DefaultConnection.ConnectionStringByDefaultDB, CommandType.Text, cmdText.ToString(), para)); } catch (ArgumentNullException ex) { logger.Error("调用方法Update()发生ArgumentNullException", ex); } catch (SqlException ex) { logger.Error("调用方法Update()发生SqlException", ex); } catch (Exception ex) { logger.Error("调用方法Update()发生Exception", ex); } return(-1); }
/// <summary> /// 修改一个实体 /// </summary> /// <param name="_entity"></param> /// <returns></returns> public int Update(Models.APP.Message model) { return(dal.Update(model)); }
/// <summary> /// 添加一条数据 /// </summary> /// <param name="model">数据实体</param> /// <returns></returns> public int Add(Models.APP.Message model) { return(dal.Add(model)); }
/// <summary> /// 添加一条数据 /// </summary> /// <param name="model">数据实体</param> /// <returns></returns> public int Add(Models.APP.Message model) { try { SqlParameter[] para = { new SqlParameter("@m_id", model.m_id), new SqlParameter("@a_id", model.a_id), new SqlParameter("@context", model.context), new SqlParameter("@type", model.type), new SqlParameter("@pic", model.pic), new SqlParameter("@title", model.title), new SqlParameter("@isread", model.isread), new SqlParameter("@createtime", model.createtime), new SqlParameter("@modifytime", model.modifytime), new SqlParameter("@userid", model.userid), new SqlParameter("@muserid", model.muserid), new SqlParameter("@isactivaty", model.isactivaty) }; StringBuilder cmdText = new StringBuilder(); cmdText.Append(@"INSERT INTO App_Message( m_id ,a_id ,context ,type ,pic ,title ,isread ,createtime ,modifytime ,userid ,muserid ,isactivaty ) VALUES( @m_id ,@a_id ,@context ,@type ,@pic ,@title ,@isread ,@createtime ,@modifytime ,@userid ,@muserid ,@isactivaty );SELECT @@Identity" ); return(SqlHelper.ExecuteNonQuery(DefaultConnection.ConnectionStringByDefaultDB, CommandType.Text, cmdText.ToString(), para)); } catch (ArgumentNullException ex) { logger.Error("调用方法Add()发生ArgumentNullException", ex); } catch (SqlException ex) { logger.Error("调用方法Add()发生SqlException", ex); } catch (Exception ex) { logger.Error("调用方法Add()发生Exception", ex); } return(-1); }