Ejemplo n.º 1
0
        /// <summary>
        /// ���½�ɫ,��ӵIJ���
        /// </summary>
        /// <param name="oParam"></param>
        /// <returns></returns>
        public int UpdateRole_DBC(RoleInfo oParam, string paramDelSql)
        {
            int _return = 0;

            string[] strPrivilege = paramDelSql.Split(',');
            //oParam.SysNo = SequenceDac.GetInstance().Create("Sys_Sequence");
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                _return = new RoleDac().Update_DBC(oParam);
                _return = new RoleDac().DelPrivilegeRole(paramDelSql, oParam.SysNo);
                for (int i = 0; i < strPrivilege.Length; i++)
                {
                    if (Util.IsNumber(strPrivilege[i]))
                        _return = new RoleDac().InsertPrivilegeRole(oParam.SysNo, Int16.Parse(strPrivilege[i]));
                }
                scope.Complete();
            }
            return _return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ɾ����ɫ
        /// </summary>
        /// <param name="oParam"></param>
        /// <returns></returns>
        public int DeleteRole(int SysNo)
        {
            int _return = 0;

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                _return = new RoleDac().DeleteRole(SysNo);
                scope.Complete();
            }
            return _return;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ���ӽ�ɫ����ɫID�����ظ�,�����˲���
        /// </summary>
        /// <param name="oParam"></param>
        /// <returns></returns>
        public int InsertRole_DBC(RoleInfo oParam,string paramDelSql)
        {
            //string sql = "select top 1 sysno from sys_role where roleid = " + Util.ToSqlString((oParam.RoleID));
            //DataSet ds = SqlHelper.ExecuteDataSet(sql);
            //if (Util.HasMoreRow((ds)))
            //    throw new BizException("the same Role ID exists");

            //oParam.SysNo = SequenceDac.GetInstance().Create("Sys_Sequence");

            //return new RoleDac().Insert(oParam);

            int _return = 0;

            string[] strPrivilege = paramDelSql.Split(',');
            oParam.SysNo = SequenceDac.GetInstance().Create("Sys_Sequence");
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                _return = new RoleDac().Insert_DBC(oParam);
                _return = new RoleDac().DelPrivilegeRole(paramDelSql, oParam.SysNo);
                for (int i = 0; i < strPrivilege.Length; i++)
                {
                    if (Util.IsNumber(strPrivilege[i]))
                    _return = new RoleDac().InsertPrivilegeRole(oParam.SysNo, Int16.Parse(strPrivilege[i]));
                }
                scope.Complete();
            }
            return _return;
        }