Beispiel #1
0
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="model">数据实体</param>
        /// <returns></returns>
        public int Add(Models.APP.Share model)
        {
            try
            {
                SqlParameter[] para =
                {
                    new SqlParameter("@a_id",       model.a_id),
                    new SqlParameter("@type",       model.type),
                    new SqlParameter("@m_id",       model.m_id),
                    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(@"INSERT INTO App_Share(
			                        a_id
						            ,type
						            ,m_id
						            ,createtime
						            ,modifytime
						            ,userid
						            ,muserid
						  ) VALUES(
									@a_id
									,@type
									,@m_id
									,@createtime
									,@modifytime
									,@userid
									,@muserid
					)"                    );

                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);
        }
Beispiel #2
0
        /// <summary>
        /// 修改一个实体
        /// </summary>
        /// <param name="_entity"></param>
        /// <returns></returns>
        public int Update(Models.APP.Share model)
        {
            try
            {
                SqlParameter[] para =
                {
                    new SqlParameter("@s_id",       model.s_id),
                    new SqlParameter("@a_id",       model.a_id),
                    new SqlParameter("@type",       model.type),
                    new SqlParameter("@m_id",       model.m_id),
                    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_Share]
								SET [a_id]=@a_id
									   ,[type]=@type
							       ,[m_id]=@m_id
							       ,[createtime]=@createtime
							       ,[modifytime]=@modifytime
							       ,[userid]=@userid
							       ,[muserid]=@muserid
							  WHERE [s_id]=@s_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);
        }
Beispiel #3
0
 /// <summary>
 /// 修改一个实体
 /// </summary>
 /// <param name="_entity"></param>
 /// <returns></returns>
 public int Update(Models.APP.Share model)
 {
     return(dal.Update(model));
 }
Beispiel #4
0
 /// <summary>
 /// 添加一条数据
 /// </summary>
 /// <param name="model">数据实体</param>
 /// <returns></returns>
 public int Add(Models.APP.Share model)
 {
     return(dal.Add(model));
 }