public void MoveBottom(QAInfo oParam) { SortedList sl = GetQAListByType(oParam.Type); if (sl == null) { throw new BizException("no qa"); } 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)) { QADac o = new QADac(); foreach (QAInfo 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(QAInfo oParam) { if (oParam.OrderNum == 1) { throw new BizException("it's the top one already"); } SortedList sl = GetQAListByType(oParam.Type); if (sl == null) { throw new BizException("no QA for this type"); } TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { QADac o = new QADac(); foreach (QAInfo 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(); } }