• CodeSmith Nettier调用Transaction事务Sample


     1   public static class ProductManager
     2    {
     3        public static void In(DateTime date, string batchCode, int from, int to, int reasonId, int operatorId, int auditor,int releaseCode,
     4            IList<WareHouseRequestItem> items)
     5        {
     6            TransactionManager trans = DataRepository.Provider.CreateTransaction(); ;
     7
     8            WareHouseMovementRequest movReq = new WareHouseMovementRequest();
     9            movReq.BatchCode = batchCode;
    10            movReq.From = from;
    11            movReq.To = to;
    12            //movReq.ReasonId = reasonId;
    13            movReq.Operator = operatorId;
    14            movReq.Auditor = auditor;
    15            movReq.ReleaseCode = releaseCode;
    16            movReq.Items = new WareHouseRequestItemCollection();
    17
    18            foreach (WareHouseRequestItem item in items)
    19            {
    20                WareHouseRequestItem reqItem = new WareHouseRequestItem();
    21                reqItem.ProductId = item.ProductId;
    22                reqItem.ReasonId = item.ReasonId;
    23                reqItem.WareHouseID = item.WareHouseID;
    24                reqItem.Amount = item.Amount;
    25                reqItem.UnitPrice = item.UnitPrice;
    26                reqItem.UnitId = item.UnitId;
    27                reqItem.SumPrice = item.SumPrice;
    28                reqItem.Status = item.Status;
    29
    30                movReq.Items.Add(reqItem);
    31            }

    32
    33            //TransactionManager trans = DataRepository.Provider.CreateTransaction();
    34            BlueBeans.WareHouses.WareHouseService.Request(trans, movReq);
    35            BlueBeans.WareHouses.WareHouseService.RequestAudit(trans,movReq);
    36            trans.Commit();
    37            //Insert(trans);
    38            //Warehouse.Request(trans, );入库出库申请           
    39            //Warehouse.RequestAudit 出入库审核
    40            //trans.Commit();
    41        }

    42    }
  • 相关阅读:
    《编写高质量代码》读书笔记一
    [转] Markdown
    皓首穷经还是及时行乐!
    有用的iOS网站地址
    [股票] 入市
    https原理 就是两次http
    数据预处理
    重新建立程序员的应对方式
    ROC曲线手画
    机器学习的总结
  • 原文地址:https://www.cnblogs.com/SlashOut/p/835766.html
Copyright © 2020-2023  润新知