예제 #1
0
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="model">数据实体</param>
        /// <returns></returns>
        public int Add(Models.APP.Evaluate model)
        {
            try
            {
                SqlParameter[] para =
                {
                    new SqlParameter("@m_id",       model.m_id),
                    new SqlParameter("@userid",     model.userid),
                    new SqlParameter("@star",       model.star),
                    new SqlParameter("@context",    model.context),
                    new SqlParameter("@type",       model.type),
                    new SqlParameter("@createtime", model.createtime)
                };
                StringBuilder cmdText = new StringBuilder();
                cmdText.Append(@"INSERT INTO App_Evaluate(
			                        m_id
						            ,userid
						            ,star
						            ,context
						            ,type
						            ,createtime
						  ) VALUES(
									@m_id
									,@userid
									,@star
									,@context
									,@type
									,@createtime
					)"                    );

                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);
        }
예제 #2
0
        /// <summary>
        /// 修改一个实体
        /// </summary>
        /// <param name="_entity"></param>
        /// <returns></returns>
        public int Update(Models.APP.Evaluate model)
        {
            try
            {
                SqlParameter[] para =
                {
                    new SqlParameter("@ev_id",      model.ev_id),
                    new SqlParameter("@m_id",       model.m_id),
                    new SqlParameter("@userid",     model.userid),
                    new SqlParameter("@star",       model.star),
                    new SqlParameter("@context",    model.context),
                    new SqlParameter("@type",       model.type),
                    new SqlParameter("@createtime", model.createtime)
                };

                StringBuilder cmdText = new StringBuilder();
                cmdText.Append(@"UPDATE [App_Evaluate]
								SET [m_id]=@m_id
									   ,[userid]=@userid
							       ,[star]=@star
							       ,[context]=@context
							       ,[type]=@type
							       ,[createtime]=@createtime
							  WHERE [ev_id]=@ev_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);
        }
예제 #3
0
 /// <summary>
 /// 修改一个实体
 /// </summary>
 /// <param name="_entity"></param>
 /// <returns></returns>
 public int Update(Models.APP.Evaluate model)
 {
     return(dal.Update(model));
 }
예제 #4
0
 /// <summary>
 /// 添加一条数据
 /// </summary>
 /// <param name="model">数据实体</param>
 /// <returns></returns>
 public int Add(Models.APP.Evaluate model)
 {
     return(dal.Add(model));
 }