コード例 #1
0
        public void Delete(string ids)
        {
            var idArray = _service.ValidateSupplierIds(ids);

            _db.Delete <Supplier>(idArray);
            _db.SaveChange();
        }
コード例 #2
0
        public void Update(AdjustContractPrice model)
        {
            ValidateItems(model);

            if (_db.Table.Exists <AdjustContractPriceItem>(n => n.AdjustContractPriceId == model.Id))
            {
                _db.Delete <AdjustContractPriceItem>(n => n.AdjustContractPriceId == model.Id);
            }
            _db.Insert <AdjustContractPriceItem>(model.Items.ToArray());
            _db.Update(model);
        }
コード例 #3
0
ファイル: ShelfFacade.cs プロジェクト: radtek/EBS
        public void DeleteProduct(int shelfLayerId, string ids)
        {
            int[] idArray = _shelfService.GetWaitDeleteProductIdArray(ids);
            _db.Delete <ShelfLayerProduct>(idArray);

            _shelfService.ReOrderLayerProduct(shelfLayerId, idArray);
            _db.SaveChange();
        }
コード例 #4
0
ファイル: RoleService.cs プロジェクト: radtek/EBS
        public void Delete(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                throw new Exception("id 参数为空");
            }
            var arrIds = ids.Split(',').ToIntArray();

            foreach (var id in arrIds)
            {
                if (_db.Table.Exists <RoleMenu>(m => m.RoleId == id))
                {
                    _db.Delete <RoleMenu>(m => m.RoleId == id);
                }
            }
            _db.Delete <Role>(arrIds);
            //删除权限
        }
コード例 #5
0
 public void Update(AdjustStorePrice model)
 {
     if (_db.Table.Exists <AdjustStorePriceItem>(n => n.AdjustStorePriceId == model.Id))
     {
         _db.Delete <AdjustStorePriceItem>(n => n.AdjustStorePriceId == model.Id);
     }
     _db.Insert <AdjustStorePriceItem>(model.Items.ToArray());
     _db.Update(model);
 }
コード例 #6
0
 public void UpdateWithItem(StorePurchaseOrder model)
 {
     if (_db.Table.Exists <StorePurchaseOrderItem>(n => n.StorePurchaseOrderId == model.Id))
     {
         _db.Delete <StorePurchaseOrderItem>(n => n.StorePurchaseOrderId == model.Id);
     }
     _db.Insert <StorePurchaseOrderItem>(model.Items.ToArray());
     _db.Update(model);
 }
コード例 #7
0
        public void Delete(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                throw new Exception("id 参数为空");
            }
            var arrIds = ids.Split(',').ToIntArray();

            _db.Delete <Product>(arrIds);
        }
コード例 #8
0
ファイル: TransferOrderService.cs プロジェクト: radtek/EBS
        public void EditItem(TransferOrder entity)
        {
            //明细
            if (_db.Table.Exists <TransferOrderItem>(n => n.TransferOrderId == entity.Id))
            {
                _db.Delete <TransferOrderItem>(n => n.TransferOrderId == entity.Id);
            }

            _db.Insert(entity.Items.ToArray());
        }
コード例 #9
0
        public void DeleteShelf(int id)
        {
            var model = _db.Table.Find <Shelf>(id);

            if (model == null)
            {
                throw new Exception("货架为空");
            }
            var code = model.Code + "%";

            if (_db.Table.Exists <ShelfLayerProduct>(n => n.StoreId == model.StoreId && n.Code.Like(code)))
            {
                _db.Delete <ShelfLayerProduct>(n => n.StoreId == model.StoreId && n.Code.Like(code));
            }
            if (_db.Table.Exists <ShelfLayer>(n => n.ShelfId == id))
            {
                _db.Delete <ShelfLayer>(n => n.ShelfId == id);
            }
            _db.Delete <Shelf>(id);
        }
コード例 #10
0
        public void Delete(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                throw new Exception("id 参数为空");
            }
            var arrIds = ids.Split(',').ToIntArray();

            _db.Delete <Store>(arrIds);
            _db.SaveChange();
            //删除权限
        }
コード例 #11
0
 public void Update(AdjustSalePrice model)
 {
     if (_db.Table.Exists <AdjustSalePrice>(n => n.Code == model.Code && n.Id != model.Id))
     {
         throw new Exception("调价单号不能重复!");
     }
     if (_db.Table.Exists <AdjustSalePriceItem>(n => n.AdjustSalePriceId == model.Id))
     {
         _db.Delete <AdjustSalePriceItem>(n => n.AdjustSalePriceId == model.Id);
     }
     _db.Insert <AdjustSalePriceItem>(model.Items.ToArray());
     _db.Update(model);
 }
コード例 #12
0
        public void Delete(string id)
        {
            // var models = _db.Table.FindAll<Category>(n => n.Id.Like(id + "%"));
            var hasProduct = _db.Table.Exists <Product>(n => n.CategoryId.Like(id + "%"));

            if (hasProduct)
            {
                throw new Exception("该品类及子类下有商品,不能删除");
            }

            _db.Delete <Category>(n => n.Id.Like(id + "%"));
            // _db.Delete<Category>(models.ToArray());
        }
コード例 #13
0
        public void Edit(RoleModel model)
        {
            Role entity = new Role(model.Name, model.Description, model.Id);

            _service.Update(entity);
            // 权限
            entity.AssignMenus(model.MenuIds);
            if (_db.Table.Exists <RoleMenu>(n => n.RoleId == model.Id))
            {
                _db.Delete <RoleMenu>(n => n.RoleId == model.Id);
            }
            _db.Insert <RoleMenu>(entity.Items.ToArray());
            _db.SaveChange();
        }
コード例 #14
0
ファイル: StocktakingFacade.cs プロジェクト: radtek/EBS
        public void Edit(StocktakingModel model)
        {
            var entity = _db.Table.Find <Stocktaking>(model.Id);

            // entity = model.MapTo<Stocktaking>(entity);
            // entity.Status = StocktakingStatus.Audited;
            // entity.StocktakingType = StocktakingType.StocktakingCorect;
            entity.Items = JsonConvert.DeserializeObject <List <StocktakingItem> >(model.ItemsJson);
            if (entity.Items.Count > 0)
            {
                _db.Delete <StocktakingItem>(n => n.StocktakingId == entity.Id);
                // _db.Delete(entity.Items.ToArray());
                _db.Insert(entity.Items.ToArray());
            }
            // _db.Update(entity);
            _db.SaveChange();
        }
コード例 #15
0
ファイル: OutInOrderFacade.cs プロジェクト: radtek/EBS
        public void Edit(OutInOrderModel model)
        {
            var entity = _db.Table.Find <OutInOrder>(model.Id);

            entity               = model.MapTo <OutInOrder>(entity);
            entity.UpdatedBy     = model.EditBy;
            entity.UpdatedByName = model.EditByName;
            entity.UpdatedOn     = DateTime.Now;
            _db.Update(entity);

            var items = JsonConvert.DeserializeObject <List <OutInOrderItem> >(model.ItemsJson);

            if (items.Count == 0)
            {
                throw new FriendlyException("明细为空");
            }
            var orderType = _db.Table.Find <OutInOrderType>(entity.OutInOrderTypeId);

            if (orderType == null)
            {
                throw new FriendlyException("业务类别为空");
            }
            var billIdentity = BillIdentity.OtherInOrder;

            if (orderType.OutInInventory == OutInInventoryType.Out)
            {
                billIdentity = BillIdentity.OtherOutOrder;
            }
            var reason = "编辑";

            entity.AddRange(items, orderType);
            _db.Delete <OutInOrderItem>(n => n.OutInOrderId == entity.Id);
            _db.Insert(entity.Items.ToArray());
            _processHistoryService.Track(entity.UpdatedBy, entity.UpdatedByName, (int)entity.Status, entity.Id, billIdentity.ToString(), reason);
            _db.SaveChange();
            if (model.SaveAndSubmit)
            {
                var modelEntity = _db.Table.Find <OutInOrder>(n => n.Code == entity.Code);
                model.Id = modelEntity.Id;
                Submit(model.Id, model.EditBy, model.EditByName);
            }
        }
コード例 #16
0
ファイル: PurchaseContractFacade.cs プロジェクト: radtek/EBS
        public void Edit(EditPurchaseContract model)
        {
            var entity = _db.Table.Find <PurchaseContract>(model.Id);

            if (model.Code != entity.Code)
            {
                _service.ValidateContractCode(model.Code);
            }
            entity = model.MapTo <PurchaseContract>(entity);
            entity.AddPurchaseContractItem(model.ConvertJsonToPurchaseContractItem());
            entity.UpdatedOn = DateTime.Now;

            //  _service.ValidateContract(entity);
            _db.Update(entity);
            _db.Delete <PurchaseContractItem>(n => n.PurchaseContractId == model.Id);
            _db.Insert <PurchaseContractItem>(entity.Items.ToArray());
            var reason = "修改合同";

            _processHistoryService.Track(model.UpdatedBy, model.UpdatedByName, (int)entity.Status, entity.Id, FormType.PurchaseContract, reason);
            _db.SaveChange();
        }
コード例 #17
0
 public void Delete(int id)
 {
     _dbContext.Delete(id);
 }
コード例 #18
0
 public void PersistDelete(IAggregateRoot aggregate)
 {
     _dbContext.Delete(ConvertToDatabaseType(aggregate));
 }
コード例 #19
0
        //修改辩题
        public bool Update(VoteRequest request, int sysUserId, out string msg)
        {
            msg = string.Empty;
            bool flag = false;

            try
            {
                if (request.Title.IsEmpty())
                {
                    msg = "辩题标题不能为空";
                    return(flag);
                }

                if (request.VoteStartTime == DateTime.MinValue || request.VoteStartTime == DateTime.MaxValue || request.VoteStartTime < DateTime.Now)
                {
                    msg = "投票开始时间有误";
                    return(flag);
                }

                if (request.VoteEndTime == DateTime.MinValue || request.VoteEndTime == DateTime.MaxValue)
                {
                    msg = "投票结束时间有误";
                    return(flag);
                }

                if (request.VoteStartTime > request.VoteEndTime)
                {
                    msg = "投票结束时间必须晚于开始时间";
                    return(flag);
                }

                if (request.VoteDetail == null || request.VoteDetail.Count == 0)
                {
                    msg = "投票辩题不能为空";
                }

                var model = _dbContext.Get <t_sys_vote>(request.VoteId);
                model.updatetime    = DateTime.Now;
                model.voteEndTime   = request.VoteEndTime;
                model.voteStartTime = request.VoteStartTime;
                model.title         = request.Title;
                model.remark        = request.Remark;
                var voteDetail = _dbContext.Select <t_sys_vote_detail>(c => c.voteId == request.VoteId).ToList();
                try
                {
                    _dbContext.BeginTransaction();
                    if (voteDetail != null && voteDetail.Count > 0)
                    {
                        foreach (var item in voteDetail)
                        {
                            var detail = request.VoteDetail.FirstOrDefault(c => c.Id == item.id);
                            if (detail == null)
                            {
                                _dbContext.Delete(item);
                            }
                            else
                            {
                                item.title = detail.Title;
                                _dbContext.Update(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (var item in request.VoteDetail)
                        {
                            _dbContext.Insert(new t_sys_vote_detail
                            {
                                numberOfVotes = 0,
                                title         = item.Title,
                                voteId        = request.VoteId
                            });
                        }
                    }
                    _dbContext.Update(model);
                    _dbContext.CommitChanges();
                    flag = true;
                }
                catch (Exception ex)
                {
                    _dbContext.Rollback();
                    flag = false;
                    msg  = "服务异常";
                    LogUtils.LogError("VoteService.UpdateTran", ex);
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = "服务异常";
                LogUtils.LogError("VoteService.Update", ex);
            }
            return(flag);
        }
コード例 #20
0
 public void Delete(ValueObjectType databaseModel)
 {
     _dbContext.Delete(ConvertToDatabaseType(databaseModel));
 }