Ejemplo n.º 1
0
        public void Edit(AdjustContractPriceModel model)
        {
            var entity = _db.Table.Find <AdjustContractPrice>(model.Id);

            entity.CheckEditStatus();
            entity = model.MapTo <AdjustContractPrice>(entity);
            entity.AddItems(model.ConvertJsonToItem());
            entity.UpdatedOn = DateTime.Now;
            _service.Update(entity);
            var reason = "修改合同调价单";

            _processHistoryService.Track(model.UpdatedBy, model.UpdatedByName, (int)entity.Status, entity.Id, BillIdentity.AdjustContractPrice.ToString(), reason);
            _db.SaveChange();
        }
Ejemplo n.º 2
0
        public void Create(AdjustContractPriceModel model)
        {
            var entity = new AdjustContractPrice();

            entity = model.MapTo <AdjustContractPrice>();
            entity.SetItems(model.ConvertJsonToItem());
            _service.ValidateItems(entity);
            entity.CreatedBy = model.UpdatedBy;
            entity.Code      = _sequenceService.GenerateNewCode(BillIdentity.AdjustContractPrice);
            _db.Insert(entity);
            // 直接调整合同价,不存在的商品,添加,存在的商品直接修改价格
            var reason  = "创建合同调价单";
            var history = new ProcessHistory(model.UpdatedBy, model.UpdatedByName, (int)entity.Status, entity.Id, BillIdentity.AdjustContractPrice.ToString(), reason);

            _db.Command.AddExecute(history.CreateSql(entity.GetType().Name, entity.Code), history);

            _db.SaveChange();
        }