Example #1
0
        //ɾ����Ʒ���Զ�������
        public int DeleteAttribute2(int attribute2SysNo)
        {
            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 CategoryDac().DeleteAttribute2(attribute2SysNo);
                scope.Complete();
            }
            return _return;
        }
Example #2
0
        public void InitAttribute(int paramC3SysNo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                CategoryDac o = new CategoryDac();

                CategoryAttributeInfo oItem = new CategoryAttributeInfo();
                for(int i=1; i<=attributeCapacity; i++ )
                {
                    oItem.C3SysNo = paramC3SysNo;
                    oItem.AttributeID = "A" + i.ToString();
                    oItem.AttributeName = "" + i.ToString();
                    oItem.OrderNum = i;
                    oItem.Status = (int)AppEnum.BiStatus.InValid;
                    oItem.AttributeType = (int)AppEnum.AttributeType.Text;
                    o.InsertAttribute(oItem);
                }

                scope.Complete();
            }
        }
Example #3
0
        public void MoveTop(CategoryAttribute1Info oParam)
        {
            if ( oParam.OrderNum == 1 )
            {
                throw new BizException("it's the top one already");
            }
            SortedList sl = GetAttribute1List(oParam.C3SysNo);
            if ( sl == null )
            {
                throw new BizException("no attribute for this third category");
            }

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                CategoryDac o = new CategoryDac();

                foreach(CategoryAttribute1Info item  in sl.Keys)
                {
                    if ( item.OrderNum < oParam.OrderNum )
                    {
                        item.OrderNum = item.OrderNum+1;
                        o.SetOrderNum(item);
                    }
                }
                oParam.OrderNum = 1;
                o.SetOrderNum(oParam);

                scope.Complete();
            }
        }
Example #4
0
        public void MoveUp(CategoryAttribute2Info oParam)
        {
            if ( oParam.OrderNum == 1 )
            {
                throw new BizException("it's the first one, can't be moved up");
            }
            SortedList sl = GetAttribute2List(oParam.A1SysNo);
            if ( sl == null )
            {
                throw new BizException("no attributes");
            }

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                CategoryDac o = new CategoryDac();

                foreach(CategoryAttribute2Info item  in sl.Keys)
                {
                    if ( item.OrderNum == oParam.OrderNum-1 )
                    {
                        item.OrderNum += 1;
                        o.SetOrderNum(item);
                    }
                }
                oParam.OrderNum -= 1;
                o.SetOrderNum(oParam);

                scope.Complete();
            }
        }
Example #5
0
        public void MoveBottom(CategoryAttribute2OptionInfo oParam)
        {
            SortedList sl = GetAttribute2OptionList(oParam.Attribute2SysNo);
            if ( sl == null )
            {
                throw new BizException("no attributes");
            }

            if ( oParam.OrderNum == sl.Count )
            {
                throw new BizException("it's the last one, can't be moved down");
            }

            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                CategoryDac o = new CategoryDac();

                foreach(CategoryAttribute2OptionInfo item  in sl.Keys)
                {
                    if ( item.OrderNum > oParam.OrderNum )
                    {
                        item.OrderNum = item.OrderNum-1;
                        o.SetOrderNum(item);
                    }
                }
                oParam.OrderNum = attributeCapacity;
                o.SetOrderNum(oParam);

                scope.Complete();
            }
        }