Пример #1
0
        /// <summary>
        ///更新记录
        /// </summary>
        /// <param name="UserPromotions"></param>
        /// <returns></returns>
        public bool GetUpdate(M_UserPromotions model)
        {
            string sqlStr = "UPDATE [dbo].[ZL_UserPromotions] SET [GroupID] = @GroupID,[NodeID] = @NodeID,[ModelID] = @ModelID,[look] = @look,[addTo] = @addTo,[Modify] = @Modify,[Columns] = @Columns,[Comments] = @Comments,[Deleted]=@Deleted,[quote]=@quote,[down]=@quote WHERE [pid] = @pid";

            SqlParameter[] cmdParams = model.GetParameters();
            return(SqlHelper.ExecuteSql(sqlStr, cmdParams));
        }
Пример #2
0
        /// <summary>
        /// 从节点添加
        /// </summary>
        /// <param name="userpromotions"></param>
        /// <returns></returns>
        public int GetInsertByNodeGroup(M_UserPromotions userpromotions)
        {
            string sqlStr = "INSERT INTO [dbo].[ZL_UserPromotions] ([GroupID],[NodeID],[look],[addTo],[Modify],[Columns],[Comments],[Deleted],[quote],[down]) VALUES (@GroupID,@NodeID,@look,@addTo,@Modify,@Columns,@Comments,@Deleted,@quote,@down);select @@IDENTITY";

            SqlParameter[] cmdParams = userpromotions.GetParameters();
            return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams)));
        }
Пример #3
0
        /// <summary>
        /// 从节点更新
        /// </summary>
        /// <param name="userpromotions"></param>
        /// <returns></returns>
        public bool GetUpdateByNodeGroup(M_UserPromotions userpromotions)
        {
            string sqlStr = "UPDATE [dbo].[ZL_UserPromotions] SET [look] = @look,[addTo] = @addTo,[Modify] = @Modify,[Columns] = @Columns,[Comments] = @Comments,[Deleted]=@Deleted,[quote]=@quote,[down]=@down WHERE [GroupID] = @GroupID and [NodeID] = @NodeID";

            SqlParameter[] cmdParams = userpromotions.GetParameters();
            return(SqlHelper.ExecuteSql(sqlStr, cmdParams));
        }
Пример #4
0
        /// <summary>
        /// 存在则更新,否则更新
        /// </summary>
        /// <param name="userpromotions"></param>
        /// <returns></returns>
        public bool GetInsertOrUpdate(M_UserPromotions userpromotions)
        {
            string sqls = "Select count(*) from [dbo].[ZL_UserPromotions] where [GroupID] = @GroupID and [NodeID] = @NodeID";

            SqlParameter[] cmdParams = userpromotions.GetParameters();
            int            Pcount    = SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqls, cmdParams));

            if (Pcount > 0)
            {
                string sqlStr = "UPDATE [dbo].[ZL_UserPromotions] SET [look] = @look,[addTo] = @addTo,[Modify] = @Modify,[Columns] = @Columns,[Comments] = @Comments,[Deleted]=@Deleted,[quote]=@quote,[down]=@down  WHERE [GroupID] = @GroupID and [NodeID] = @NodeID";
                return(SqlHelper.ExecuteSql(sqlStr, cmdParams));
            }
            else
            {
                string sqlStr = "INSERT INTO [dbo].[ZL_UserPromotions] ([GroupID],[NodeID],[look],[addTo],[Modify],[Columns],[Comments],[Deleted],[quote],[down]) VALUES (@GroupID,@NodeID,@look,@addTo,@Modify,@Columns,@Comments,@Deleted,@quote,@down);select @@IDENTITY";
                return(SqlHelper.ObjectToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sqlStr, cmdParams)) > 0);
            }
        }
Пример #5
0
 /// <summary>
 ///添加记录
 /// </summary>
 /// <param name="UserPromotions"></param>
 /// <returns></returns>
 public int GetInsert(M_UserPromotions model)
 {
     return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }