Пример #1
0
        public static int update(DBInstance dbmgr, List <Param> request, int id = 0)
        {
            //id=0为插入新字段

            using (DbConnection conn = dbmgr.GetDbConnection())
            {
                conn.Open();
                using (DbTransaction tx = conn.BeginTransaction())
                {
                    string sql = "";

                    if (id == 0)
                    {
                        id  = dbmgr.getNewId("tb_notify_log");
                        sql = "insert into tb_notify_log (id,created_user,created_date,updated_user,updated_date,`notify_time`,`log_request`,`log_url` ) values (" + id.ToString() + ",-2,now(),-2,now(),@notify_time ,@log_request ,@log_url  )";
                    }
                    else
                    {
                        sql = "update tb_notify_log set updated_user=-2, updated_date=now() ,`notify_time`=@notify_time ,`log_request`=@log_request ,`log_url`=@log_url  where id=" + id.ToString();
                    }

                    dbmgr.ExecuteNonQuery(tx, sql, request);



                    tx.Commit();
                    return(id);
                }
            }
        }
Пример #2
0
        public static int update(DBInstance dbmgr, List <Param> request, int id = 0)
        {
            //id=0为插入新字段

            using (DbConnection conn = dbmgr.GetDbConnection())
            {
                conn.Open();
                using (DbTransaction tx = conn.BeginTransaction())
                {
                    string sql = "";

                    if (id == 0)
                    {
                        id  = dbmgr.getNewId("tb_payment");
                        sql = "insert into tb_payment (id,created_user,created_date,updated_user,updated_date,`orderno`,`time_end`,`openid`,`total_fee`,`trade_type`,`transaction_id`,`result_code` ) values (" + id.ToString() + ",-2,now(),-2,now(),@orderno ,@time_end ,@openid ,@total_fee ,@trade_type ,@transaction_id ,@result_code  )";
                    }
                    else
                    {
                        sql = "update tb_payment set updated_user=-2, updated_date=now() ,`orderno`=@orderno ,`time_end`=@time_end ,`openid`=@openid ,`total_fee`=@total_fee ,`trade_type`=@trade_type ,`transaction_id`=@transaction_id ,`result_code`=@result_code  where id=" + id.ToString();
                    }

                    dbmgr.ExecuteNonQuery(tx, sql, request);



                    tx.Commit();
                    return(id);
                }
            }
        }