public void MoveUp(ProductBasicInfo oParam) { if (oParam.OrderNum == 1) { throw new BizException("it's the first one, can't be moved up"); } SortedList sl = GetC3Product(oParam.C3SysNo); 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)) { ProductBasicDac o = new ProductBasicDac(); foreach (ProductBasicInfo item in sl.Values) { if (item.OrderNum == oParam.OrderNum - 1) { item.OrderNum += 1; o.SetOrderNum(item); } } oParam.OrderNum -= 1; o.SetOrderNum(oParam); scope.Complete(); } }
public void UpdateBasicInfo(ProductBasicInfo oParam) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { ProductBasicDac pb = new ProductBasicDac(); pb.Update(oParam); scope.Complete(); } }
/// <summary> /// ����С������Ʒ����ʾ˳�� /// </summary> /// <param name="oParam"></param> /// public void MoveTop(ProductBasicInfo oParam) { if (oParam.OrderNum == 1) { throw new BizException("it's the top one already"); } SortedList sl = GetC3Product(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)) { ProductBasicDac o = new ProductBasicDac(); foreach (ProductBasicInfo item in sl.Values) { if (oParam.OrderNum == AppConst.IntNull || oParam.OrderNum <= 0 || item.OrderNum < oParam.OrderNum) { if (item.OrderNum != AppConst.IntNull && item.OrderNum > 0) { item.OrderNum = item.OrderNum + 1; o.SetOrderNum(item); } } } oParam.OrderNum = 1; o.SetOrderNum(oParam); scope.Complete(); } }