Exemple #1
0
        /// <summary>
        ///根据id修改一条数据(返)修改结果)
        /// </summary>
        public bool Update(Models.Class Models)
        {
            string sqlStr = " update [MS_Class] set CREATE_GUID=@CREATE_GUID,CLASS_NAME=@CLASS_NAME,CLASS_ID=@CLASS_ID,CLASS_NO=@CLASS_NO,SORT=@SORT,LAST_CHANGE_TIME=@LAST_CHANGE_TIME,LAST_CHANGE_IP=@LAST_CHANGE_IP,LAST_CHANGE_GUID=@LAST_CHANGE_GUID,STATE=@STATE where id = @id";

            using (var connection = new ConnectionCode().GetConnection())
            {
                return(connection.Execute(sqlStr, Models) > 0);
            }
        }
Exemple #2
0
        /// <summary>
        ///添加一条数据(返)插入的数据的id)
        /// </summary>
        public int Add(Models.Class Models)
        {
            string sqlStr = " insert into [MS_Class](CREATE_GUID,CLASS_NAME,CLASS_ID,CLASS_NO,SORT,LAST_CHANGE_TIME,LAST_CHANGE_IP,LAST_CHANGE_GUID,STATE) values(@CREATE_GUID,@CLASS_NAME,@CLASS_ID,@CLASS_NO,@SORT,@LAST_CHANGE_TIME,@LAST_CHANGE_IP,@LAST_CHANGE_GUID,@STATE);select @@identity ";

            using (var connection = new ConnectionCode().GetConnection())
            {
                return(connection.Query <int>(sqlStr, Models).SingleOrDefault());
            }
        }