Ejemplo n.º 1
0
        public int Insert(WebMenuInfo menuInfo)
        {
            var menuId = 0;

            menuInfo.Taxis = GetMaxTaxis(menuInfo.ParentId) + 1;

            IDataParameter[] parms = null;

            var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        menuId = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(menuId);
        }
Ejemplo n.º 2
0
        public void Update(WebMenuInfo menuInfo)
        {
            IDataParameter[] parms = null;
            var SQL_UPDATE         = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            ExecuteNonQuery(SQL_UPDATE, parms);
        }
Ejemplo n.º 3
0
        public int Insert(WebMenuInfo menuInfo)
        {
            var menuID = 0;

            menuInfo.Taxis = GetMaxTaxis(menuInfo.ParentID) + 1;

            IDataParameter[] parms = null;

            var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        ExecuteNonQuery(trans, SQL_INSERT, parms);

                        menuID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(menuID);
        }
Ejemplo n.º 4
0
        public void Update(WebMenuInfo menuInfo)
        {
            IDataParameter[] parms = null;
            var sqlUpdate          = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(menuInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }