Esempio n. 1
0
        /// <summary>更新一条数据
        ///
        /// </summary>
        public bool Update(Niunan.CaiPiao.Model.Xiazhuinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update xiazhuinfo set ");
            strSql.Append("createtime=@createtime, userid=@userid, username=@username, czid=@czid, czname=@czname, wfid=@wfid, wfname=@wfname, buycode=@buycode, beishu=@beishu, buymoney=@buymoney, remark=@remark, qihao=@qihao, iszj=@iszj, zjmoney=@zjmoney, kjcode=@kjcode, shouxufee=@shouxufee, czr=@czr, kjtime=@kjtime  ");
            strSql.Append(" where id=@id ");
            using (var connection = ConnectionFactory.GetOpenConnection(ConnStr))
            {
                int i = connection.Execute(strSql.ToString(), model);
                return(i > 0);
            }
        }
Esempio n. 2
0
        /// <summary>得到一个对象实体
        ///
        /// </summary>
        public Niunan.CaiPiao.Model.Xiazhuinfo GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from xiazhuinfo ");
            strSql.Append(" where id=@id ");
            Niunan.CaiPiao.Model.Xiazhuinfo model = null;
            using (var connection = ConnectionFactory.GetOpenConnection(ConnStr))
            {
                model = connection.QuerySingleOrDefault <Niunan.CaiPiao.Model.Xiazhuinfo>(strSql.ToString(), new { id = id });
            }
            return(model);
        }
Esempio n. 3
0
        /// <summary>增加一条数据
        ///
        /// </summary>
        public int Add(Niunan.CaiPiao.Model.Xiazhuinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into xiazhuinfo(");
            strSql.Append("createtime, userid, username, czid, czname, wfid, wfname, buycode, beishu, buymoney, remark, qihao, iszj, zjmoney, kjcode, shouxufee, czr, kjtime  )");
            strSql.Append(" values (");
            strSql.Append("@createtime, @userid, @username, @czid, @czname, @wfid, @wfname, @buycode, @beishu, @buymoney, @remark, @qihao, @iszj, @zjmoney, @kjcode, @shouxufee, @czr, @kjtime  ) ;select @@IDENTITY");

            using (var connection = ConnectionFactory.GetOpenConnection(ConnStr))
            {
                int i = connection.QueryFirst <int>(strSql.ToString(), model);
                return(i);
            }
        }
Esempio n. 4
0
        /// <summary>根据条件得到一个对象实体
        ///
        /// </summary>
        public Niunan.CaiPiao.Model.Xiazhuinfo GetModelByCond(string cond)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  * from xiazhuinfo ");
            if (!string.IsNullOrEmpty(cond))
            {
                strSql.Append(" where " + cond);
            }
            strSql.Append(" limit 1;");
            Niunan.CaiPiao.Model.Xiazhuinfo model = null;
            using (var connection = ConnectionFactory.GetOpenConnection(ConnStr))
            {
                model = connection.QuerySingleOrDefault <Niunan.CaiPiao.Model.Xiazhuinfo>(strSql.ToString());
            }
            return(model);
        }