public void MoveBottom(SlnItemInfo oParam) { SortedList sl = GetSlnItemList(oParam.SlnSysNo); if (sl == null) { throw new BizException("no items"); } 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)) { SlnDac o = new SlnDac(); foreach (SlnItemInfo item in sl.Keys) { if (item.OrderNum > oParam.OrderNum) { item.OrderNum = item.OrderNum - 1; o.SetOrderNum(item); } } oParam.OrderNum = sl.Count; o.SetOrderNum(oParam); scope.Complete(); } }
public void MoveTop(SlnItemInfo oParam) { if (oParam.OrderNum == 1) { throw new BizException("it's the top one already"); } SortedList sl = GetSlnItemList(oParam.SlnSysNo); if (sl == null) { throw new BizException("no item for this solution"); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { SlnDac o = new SlnDac(); foreach (SlnItemInfo 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(); } }