Example #1
0
        public Item UpdateLegacyObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                                       IBarringService _barringService, IContactService _contactService, IMachineService _machineService,
                                       IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
        {
            Barring barring = _barringService.GetObjectById(item.Id);

            if (barring != null)
            {
                _barringService.UpdateObject(barring, _barringService, _uomService, this, _itemTypeService,
                                             _contactService, _machineService, _warehouseItemService, _warehouseService,
                                             _contactGroupService, _priceMutationService);
                return(barring);
            }

            if (_validator.ValidUpdateLegacyObject(item, _uomService, this, _itemTypeService))
            {
                ContactGroup  contactGroup     = _contactGroupService.GetObjectByIsLegacy(true);
                Item          olditem          = _repository.GetObjectById(item.Id); // Note: olditem might be pointing to the same memory with item (share the same contents)
                PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(item.PriceMutationId);
                if (olditem.SellingPrice != item.SellingPrice)
                {
                    DateTime      priceMutationTimeStamp = DateTime.Now;
                    PriceMutation priceMutation          = _priceMutationService.CreateObject(item, /*contactGroup,*/ priceMutationTimeStamp);
                    item.PriceMutationId = priceMutation.Id;
                    _priceMutationService.DeactivateObject(oldpriceMutation, priceMutationTimeStamp);
                }
                item = _repository.UpdateObject(item);
            }
            return(item);
        }
        public CustomPurchaseInvoiceDetail UnconfirmObject(CustomPurchaseInvoiceDetail customPurchaseInvoiceDetail, IWarehouseItemService _warehouseItemService,
                                                           IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService, IStockMutationService _stockMutationService, IPriceMutationService _priceMutationService)
        {
            if (_validator.ValidUnconfirmObject(customPurchaseInvoiceDetail))
            {
                Item item = _itemService.GetObjectById(customPurchaseInvoiceDetail.ItemId);
                //CustomPurchaseInvoiceDetail hiCustomPurchaseInvoiceDetail = GetAll().Where(x => x.ItemId == item.Id).OrderByDescending(x => x.Price).FirstOrDefault();
                decimal hiPrice  = GetHighestPrice(/*customPurchaseInvoiceDetail.CustomPurchaseInvoiceId,*/ customPurchaseInvoiceDetail.ItemId);
                decimal newPrice = hiPrice * (100 + item.Margin) / 100;
                if (newPrice > item.SellingPrice)
                {
                    item.SellingPrice = newPrice;
                    PriceMutation priceMutation = _priceMutationService.CreateObject(item.Id, item.SellingPrice, DateTime.Now);
                    item.PriceMutationId = priceMutation.Id;
                }
                decimal itemPrice = customPurchaseInvoiceDetail.Amount / customPurchaseInvoiceDetail.Quantity;
                item.AvgPrice = _itemService.CalculateAndUpdateAvgPrice(item, customPurchaseInvoiceDetail.Quantity * (-1), itemPrice);

                IList <StockMutation> stockMutations = _stockMutationService.GetObjectsBySourceDocumentDetailForItem(customPurchaseInvoiceDetail.ItemId, Core.Constants.Constant.SourceDocumentDetailType.CustomPurchaseInvoiceDetail, customPurchaseInvoiceDetail.Id);
                foreach (var stockMutation in stockMutations)
                {
                    stockMutation.Errors = new Dictionary <string, string>();
                    _stockMutationService.ReverseStockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService);
                    _stockMutationService.SoftDeleteObject(stockMutation, _warehouseService, _warehouseItemService, _itemService, _barringService);
                }
                customPurchaseInvoiceDetail.CoGS = 0;
                customPurchaseInvoiceDetail      = _repository.UnconfirmObject(customPurchaseInvoiceDetail);
            }
            return(customPurchaseInvoiceDetail);
        }
Example #3
0
        public PriceMutation CreateObject(int ItemId, /*int ContactGroupId,*/ decimal Price, DateTime CreationDate)
        {
            PriceMutation priceMutation = new PriceMutation()
            {
                ItemId = ItemId,
                //ContactGroupId = ContactGroupId,
                Amount    = Price,
                CreatedAt = CreationDate
            };

            return(this.CreateObject(priceMutation));
        }
Example #4
0
        public string PrintError(PriceMutation obj)
        {
            string erroroutput = "";
            KeyValuePair <string, string> first = obj.Errors.ElementAt(0);

            erroroutput += first.Key + "," + first.Value;
            foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1))
            {
                erroroutput += Environment.NewLine;
                erroroutput += pair.Key + "," + pair.Value;
            }
            return(erroroutput);
        }
Example #5
0
 public GroupItemPrice CreateObject(GroupItemPrice groupItemPrice, IContactGroupService _contactGroupService, IItemService _itemService, IPriceMutationService _priceMutationService)
 {
     groupItemPrice.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(groupItemPrice, this, _contactGroupService, _itemService))
     {
         Item item = _itemService.GetObjectById(groupItemPrice.ItemId);
         groupItemPrice.CreatedAt = DateTime.Now;
         PriceMutation priceMutation = _priceMutationService.CreateObject(item.Id, /*groupItemPrice.ContactGroupId,*/ item.SellingPrice, groupItemPrice.CreatedAt);
         groupItemPrice.PriceMutationId = priceMutation.Id;
         groupItemPrice = _repository.CreateObject(groupItemPrice);
     }
     return(groupItemPrice);
 }
Example #6
0
 public Item CreateLegacyObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                                IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
 {
     item.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateLegacyObject(item, _uomService, this, _itemTypeService))
     {
         ContactGroup contactGroup = _contactGroupService.GetObjectByIsLegacy(true);
         item = _repository.CreateObject(item);
         PriceMutation priceMutation = _priceMutationService.CreateObject(item, /*contactGroup,*/ item.CreatedAt);
         item.PriceMutationId = priceMutation.Id;
         _repository.UpdateObject(item);
     }
     return(item);
 }
Example #7
0
 public GroupItemPrice UpdateObject(GroupItemPrice groupItemPrice, int oldGroupId, int oldItemId, IItemService _itemService, IPriceMutationService _priceMutationService)
 {
     if (_validator.ValidUpdateObject(groupItemPrice, oldGroupId, oldItemId, this, _priceMutationService))
     {
         Item          item             = _itemService.GetObjectById(groupItemPrice.ItemId);
         PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(item.PriceMutationId);
         groupItemPrice.UpdatedAt = DateTime.Now;
         PriceMutation priceMutation = _priceMutationService.CreateObject(item.Id, /*groupItemPrice.ContactGroupId,*/ item.SellingPrice, (DateTime)groupItemPrice.UpdatedAt.GetValueOrDefault());
         groupItemPrice.PriceMutationId = priceMutation.Id;
         groupItemPrice = _repository.UpdateObject(groupItemPrice);
         _priceMutationService.DeactivateObject(oldpriceMutation, groupItemPrice.UpdatedAt);
     }
     return(groupItemPrice);
 }
Example #8
0
 public RetailPurchaseInvoiceDetail UpdateObject(RetailPurchaseInvoiceDetail retailPurchaseInvoiceDetail, IRetailPurchaseInvoiceService _retailPurchaseInvoiceService,
                                                 IItemService _itemService, IWarehouseItemService _warehouseItemService, IPriceMutationService _priceMutationService)
 {
     if (_validator.ValidUpdateObject(retailPurchaseInvoiceDetail, _retailPurchaseInvoiceService, this, _itemService, _warehouseItemService))
     {
         Item                  item                  = _itemService.GetObjectById(retailPurchaseInvoiceDetail.ItemId);
         PriceMutation         priceMutation         = _priceMutationService.GetObjectById(item.PriceMutationId);
         RetailPurchaseInvoice retailPurchaseInvoice = _retailPurchaseInvoiceService.GetObjectById(retailPurchaseInvoiceDetail.RetailPurchaseInvoiceId);
         retailPurchaseInvoiceDetail.PriceMutationId = item.PriceMutationId;
         retailPurchaseInvoiceDetail.Amount          = priceMutation.Amount * retailPurchaseInvoiceDetail.Quantity;
         retailPurchaseInvoiceDetail = _repository.UpdateObject(retailPurchaseInvoiceDetail);
         retailPurchaseInvoice.Total = CalculateTotal(retailPurchaseInvoice.Id);
         _retailPurchaseInvoiceService.GetRepository().Update(retailPurchaseInvoice);
     }
     return(retailPurchaseInvoiceDetail);
 }
Example #9
0
 public PriceMutation CreateObject(PriceMutation priceMutation)
 {
     priceMutation.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(priceMutation, this))
     {
         //priceMutation.CreatedAt = DateTime.Now;
         priceMutation = _repository.CreateObject(priceMutation);
         IList <PriceMutation> priceMutations = _repository.GetObjectsByIsActive(true, priceMutation.Id, priceMutation.ItemId /*, priceMutation.ContactGroupId*/);
         foreach (var priceMutation2 in priceMutations)
         {
             priceMutation2.Errors = new Dictionary <String, String>();
             DeactivateObject(priceMutation2, priceMutation.CreatedAt);
         }
     }
     return(priceMutation);
 }
Example #10
0
 public Barring CreateObject(Barring barring, IBarringService _barringService, IUoMService _uomService, IItemService _itemService, IItemTypeService _itemTypeService,
                             IContactService _contactService, IMachineService _machineService,
                             IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                             IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
 {
     barring.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(barring, _barringService, _uomService, _itemService, _itemTypeService, _contactService, _machineService))
     {
         ContactGroup contactGroup = _contactGroupService.GetObjectByIsLegacy(true);
         barring = _repository.CreateObject(barring);
         PriceMutation priceMutation = _priceMutationService.CreateObject(barring, /*contactGroup,*/ barring.CreatedAt);
         barring.PriceMutationId = priceMutation.Id;
         barring = _repository.UpdateObject(barring);
     }
     return(barring);
 }
Example #11
0
 public Item UpdateObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
 {
     if (_validator.ValidUpdateObject(item, _uomService, this, _itemTypeService))
     {
         ContactGroup  contactGroup     = _contactGroupService.GetObjectByIsLegacy(true);
         Item          olditem          = _repository.GetObjectById(item.Id); // Note: olditem might be pointing to the same memory with item (share the same contents)
         PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(item.PriceMutationId);
         item.UpdatedAt = DateTime.Now;
         if (olditem.SellingPrice != item.SellingPrice)
         {
             PriceMutation priceMutation = _priceMutationService.CreateObject(item, /*contactGroup,*/ (DateTime)item.UpdatedAt.GetValueOrDefault());
             item.PriceMutationId = priceMutation.Id;
             _priceMutationService.DeactivateObject(oldpriceMutation, item.UpdatedAt);
         }
         item = _repository.UpdateObject(item);
     }
     return(item);
 }
        public CustomPurchaseInvoiceDetail ConfirmObject(CustomPurchaseInvoiceDetail customPurchaseInvoiceDetail, ICustomPurchaseInvoiceService _customPurchaseInvoiceService, IWarehouseItemService _warehouseItemService,
                                                         IWarehouseService _warehouseService, IItemService _itemService, IBarringService _barringService, IStockMutationService _stockMutationService, IPriceMutationService _priceMutationService)
        {
            if (_validator.ValidConfirmObject(customPurchaseInvoiceDetail, _customPurchaseInvoiceService, _warehouseItemService))
            {
                CustomPurchaseInvoice customPurchaseInvoice = _customPurchaseInvoiceService.GetObjectById(customPurchaseInvoiceDetail.CustomPurchaseInvoiceId);
                WarehouseItem         warehouseItem         = _warehouseItemService.FindOrCreateObject(customPurchaseInvoice.WarehouseId, customPurchaseInvoiceDetail.ItemId);
                Item          item          = _itemService.GetObjectById(customPurchaseInvoiceDetail.ItemId);
                StockMutation stockMutation = new StockMutation()
                {
                    ItemId                   = customPurchaseInvoiceDetail.ItemId,
                    ItemCase                 = Core.Constants.Constant.ItemCase.Ready,
                    Status                   = Core.Constants.Constant.MutationStatus.Addition,
                    Quantity                 = customPurchaseInvoiceDetail.Quantity,
                    SourceDocumentCode       = customPurchaseInvoice.Code,
                    SourceDocumentId         = customPurchaseInvoice.Id,
                    SourceDocumentType       = Core.Constants.Constant.SourceDocumentType.CustomPurchaseInvoice,
                    SourceDocumentDetailCode = customPurchaseInvoiceDetail.Code,
                    SourceDocumentDetailId   = customPurchaseInvoiceDetail.Id,
                    SourceDocumentDetailType = Core.Constants.Constant.SourceDocumentDetailType.CustomPurchaseInvoiceDetail,
                    WarehouseId              = customPurchaseInvoice.WarehouseId,
                    WarehouseItemId          = warehouseItem.Id
                };

                decimal hiPrice  = GetHighestPrice(/*customPurchaseInvoice.Id,*/ customPurchaseInvoiceDetail.ItemId);
                decimal newPrice = hiPrice * (100 + item.Margin) / 100;
                if (newPrice > item.SellingPrice)
                {
                    item.SellingPrice = newPrice;
                    PriceMutation priceMutation = _priceMutationService.CreateObject(item.Id, item.SellingPrice, DateTime.Now);
                    item.PriceMutationId = priceMutation.Id;
                }
                decimal itemPrice = customPurchaseInvoiceDetail.Amount / customPurchaseInvoiceDetail.Quantity;
                item.AvgPrice = _itemService.CalculateAndUpdateAvgPrice(item, customPurchaseInvoiceDetail.Quantity, itemPrice);

                stockMutation           = _stockMutationService.CreateObject(stockMutation, _warehouseService, _warehouseItemService, _itemService, _barringService);
                stockMutation.CreatedAt = (DateTime)customPurchaseInvoice.ConfirmationDate.GetValueOrDefault();
                _stockMutationService.UpdateObject(stockMutation, _warehouseService, _warehouseItemService, _itemService, _barringService);
                _stockMutationService.StockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService);
                customPurchaseInvoiceDetail.CoGS = customPurchaseInvoiceDetail.Quantity * item.AvgPrice;
                customPurchaseInvoiceDetail      = _repository.ConfirmObject(customPurchaseInvoiceDetail);
            }
            return(customPurchaseInvoiceDetail);
        }
Example #13
0
 public Barring UpdateObject(Barring barring, IBarringService _barringService, IUoMService _uomService, IItemService _itemService,
                             IItemTypeService _itemTypeService, IContactService _contactService, IMachineService _machineService,
                             IWarehouseItemService _warehouseItemService, IWarehouseService _warehouseService,
                             IContactGroupService _contactGroupService, IPriceMutationService _priceMutationService)
 {
     if (_validator.ValidUpdateObject(barring, _barringService, _uomService, _itemService, _itemTypeService, _contactService, _machineService))
     {
         ContactGroup  contactGroup     = _contactGroupService.GetObjectByIsLegacy(true);
         Barring       oldbarring       = _repository.GetObjectById(barring.Id);
         PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(barring.PriceMutationId);
         if (oldbarring.SellingPrice != barring.SellingPrice)
         {
             DateTime      priceMutationTimeStamp = DateTime.Now;
             PriceMutation priceMutation          = _priceMutationService.CreateObject(oldbarring, /*contactGroup,*/ priceMutationTimeStamp);
             barring.PriceMutationId = priceMutation.Id;
             _priceMutationService.DeactivateObject(oldpriceMutation, priceMutationTimeStamp);
         }
         _repository.UpdateObject(barring);
     }
     return(barring);
 }
        public RetailSalesInvoiceDetail CreateObject(RetailSalesInvoiceDetail retailSalesInvoiceDetail, IRetailSalesInvoiceService _retailSalesInvoiceService,
                                                     IItemService _itemService, IWarehouseItemService _warehouseItemService, IPriceMutationService _priceMutationService)
        {
            retailSalesInvoiceDetail.Errors = new Dictionary <String, String>();
            if (_validator.ValidCreateObject(retailSalesInvoiceDetail, _retailSalesInvoiceService, this, _itemService, _warehouseItemService))
            {
                Item item = _itemService.GetObjectById(retailSalesInvoiceDetail.ItemId);
                RetailSalesInvoice retailSalesInvoice = _retailSalesInvoiceService.GetObjectById(retailSalesInvoiceDetail.RetailSalesInvoiceId);
                PriceMutation      priceMutation      = _priceMutationService.GetObjectById(item.PriceMutationId);

                if (retailSalesInvoiceDetail.IsManualPriceAssignment)
                {
                    //priceMutation = _priceMutationService.CreateObject(retailSalesInvoiceDetail.ItemId, retailSalesInvoiceDetail.AssignedPrice, DateTime.Now);

                    retailSalesInvoiceDetail.PriceMutationId = priceMutation.Id;
                    retailSalesInvoiceDetail.Amount          = (retailSalesInvoiceDetail.AssignedPrice * retailSalesInvoiceDetail.Quantity) * (100 - retailSalesInvoiceDetail.Discount) / 100;
                    //item.PriceMutationId = priceMutation.Id;
                    //_itemService.GetRepository().Update(item);
                }
                else
                {
                    retailSalesInvoiceDetail.PriceMutationId = item.PriceMutationId;
                    retailSalesInvoiceDetail.Amount          = (priceMutation.Amount * retailSalesInvoiceDetail.Quantity) * (100 - retailSalesInvoiceDetail.Discount) / 100;
                }
                retailSalesInvoiceDetail.CoGS = retailSalesInvoiceDetail.Quantity * item.AvgPrice;

                retailSalesInvoiceDetail = _repository.CreateObject(retailSalesInvoiceDetail);
                if (retailSalesInvoiceDetail.IsManualPriceAssignment)
                {
                    priceMutation.CreatedAt = retailSalesInvoiceDetail.CreatedAt;
                    _priceMutationService.GetRepository().Update(priceMutation);
                }

                retailSalesInvoice.Total = CalculateTotal(retailSalesInvoice.Id);
                retailSalesInvoice.Total = CalculateCoGS(retailSalesInvoice.Id);
                _retailSalesInvoiceService.GetRepository().Update(retailSalesInvoice);
            }
            return(retailSalesInvoiceDetail);
        }
Example #15
0
 public PriceMutation VDeactivateObject(PriceMutation priceMutation)
 {
     return(priceMutation);
 }
Example #16
0
        public bool isValid(PriceMutation obj)
        {
            bool isValid = !obj.Errors.Any();

            return(isValid);
        }
Example #17
0
 public bool ValidDeleteObject(PriceMutation priceMutation)
 {
     priceMutation.Errors.Clear();
     VDeleteObject(priceMutation);
     return(isValid(priceMutation));
 }
Example #18
0
 public bool ValidDeactivateObject(PriceMutation priceMutation, IPriceMutationService _priceMutationService)
 {
     priceMutation.Errors.Clear();
     VUpdateObject(priceMutation, _priceMutationService);
     return(isValid(priceMutation));
 }
Example #19
0
 public bool ValidCreateObject(PriceMutation priceMutation, IPriceMutationService _priceMutationService)
 {
     VCreateObject(priceMutation, _priceMutationService);
     return(isValid(priceMutation));
 }
Example #20
0
 public PriceMutation VDeleteObject(PriceMutation priceMutation)
 {
     return(priceMutation);
 }
Example #21
0
        void groupitemprice_validation()
        {
            it["validates_groupitemprice"] = () =>
            {
                d.groupItemPrice1.Errors.Count().should_be(0);
            };

            it["groupitemprice_with_no_price"] = () =>
            {
                GroupItemPrice groupitemprice2 = new GroupItemPrice()
                {
                    Price          = 0,
                    ItemId         = d.item.Id,
                    ContactGroupId = d.baseGroup.Id
                };
                groupitemprice2 = d._groupItemPriceService.CreateObject(groupitemprice2, d._contactGroupService, d._itemService, d._priceMutationService);
                groupitemprice2.Errors.Count().should_not_be(0);
            };

            it["groupitemprice_with_no_itemid"] = () =>
            {
                GroupItemPrice groupitemprice2 = new GroupItemPrice()
                {
                    Price          = 1000,
                    ContactGroupId = d.baseGroup.Id
                };
                groupitemprice2 = d._groupItemPriceService.CreateObject(groupitemprice2, d._contactGroupService, d._itemService, d._priceMutationService);
                groupitemprice2.Errors.Count().should_not_be(0);
            };

            it["groupitemprice_with_no_groupid"] = () =>
            {
                GroupItemPrice groupitemprice2 = new GroupItemPrice()
                {
                    Price  = 1000,
                    ItemId = d.item.Id
                };
                groupitemprice2 = d._groupItemPriceService.CreateObject(groupitemprice2, d._contactGroupService, d._itemService, d._priceMutationService);
                groupitemprice2.Errors.Count().should_not_be(0);
            };

            it["groupitemprice_with_same_idcombination"] = () =>
            {
                GroupItemPrice groupitemprice2 = new GroupItemPrice()
                {
                    Price          = 2000,
                    ItemId         = d.item.Id,
                    ContactGroupId = d.baseGroup.Id
                };
                groupitemprice2 = d._groupItemPriceService.CreateObject(groupitemprice2, d._contactGroupService, d._itemService, d._priceMutationService);
                groupitemprice2.Errors.Count().should_not_be(0);
            };

            context["when creating groupitemprice"] = () =>
            {
                before = () =>
                {
                };

                it["should create PriceMutation"] = () =>
                {
                    d._priceMutationService.GetObjectById(d.groupItemPrice1.PriceMutationId).should_not_be_null();
                };

                it["should have 1 active PriceMutation"] = () =>
                {
                    d._priceMutationService.GetObjectsByIsActive(true, d.groupItemPrice1.ItemId, /*d.groupItemPrice1.ContactGroupId,*/ 0).Count().should_be(1);
                };
            };

            it["update_with_zero_price"] = () =>
            {
                d.groupItemPrice1.Price = 0;
                d.groupItemPrice1       = d._groupItemPriceService.UpdateObject(d.groupItemPrice1, d.groupItemPrice1.ContactGroupId, d.groupItemPrice1.ItemId, d._itemService, d._priceMutationService);
                d.groupItemPrice1.Errors.Count().should_not_be(0);
            };

            it["update_with_active_price"] = () =>
            {
                PriceMutation pricemutation1 = d._priceMutationService.GetObjectsByIsActive(true, d.item.Id /*, d.baseGroup.Id*/, 0).FirstOrDefault();
                d.groupItemPrice1.Price = pricemutation1.Amount;
                d.groupItemPrice1       = d._groupItemPriceService.UpdateObject(d.groupItemPrice1, d.groupItemPrice1.ContactGroupId, d.groupItemPrice1.ItemId, d._itemService, d._priceMutationService);
                d.groupItemPrice1.Errors.Count().should_not_be(0);
            };

            it["update_with_different_itemid"] = () =>
            {
                Item item = new Item()
                {
                    ItemTypeId = d._itemTypeService.GetObjectByName("Accessory").Id,
                    Sku        = "ABC1002",
                    Name       = "CBA",
                    Category   = "ABC123",
                    UoMId      = d.Pcs.Id
                };
                item = d._itemService.CreateObject(item, d._uomService, d._itemTypeService, d._warehouseItemService, d._warehouseService, d._priceMutationService, d._contactGroupService);

                int oldGroupId = d.groupItemPrice1.ContactGroupId;
                int oldItemId  = d.groupItemPrice1.ItemId;
                d.groupItemPrice1.ItemId = item.Id;
                GroupItemPrice oldone = d._groupItemPriceService.GetObjectById(d.groupItemPrice1.Id); // TODO : Check why oldone.ItemId have the same new value with d.groupItemPrice1.ItemId
                d.groupItemPrice1 = d._groupItemPriceService.UpdateObject(d.groupItemPrice1, oldGroupId, oldItemId, d._itemService, d._priceMutationService);
                d.groupItemPrice1.Errors.Count().should_not_be(0);
            };

            it["update_with_different_groupid"] = () =>
            {
                ContactGroup contactgroup = d._contactGroupService.CreateObject("Admin", "Administrators");

                int oldGroupId = d.groupItemPrice1.ContactGroupId;
                int oldItemId  = d.groupItemPrice1.ItemId;
                d.groupItemPrice1.ContactGroupId = contactgroup.Id;
                d.groupItemPrice1 = d._groupItemPriceService.UpdateObject(d.groupItemPrice1, oldGroupId, oldItemId, d._itemService, d._priceMutationService);
                d.groupItemPrice1.Errors.Count().should_not_be(0);
            };
        }
Example #22
0
 public PriceMutation VCreateObject(PriceMutation priceMutation, IPriceMutationService _priceMutationService)
 {
     return(priceMutation);
 }
Example #23
0
 public PriceMutation VUpdateObject(PriceMutation priceMutation, IPriceMutationService _priceMutationService)
 {
     VCreateObject(priceMutation, _priceMutationService);
     return(priceMutation);
 }
Example #24
0
 public PriceMutation DeactivateObject(PriceMutation priceMutation, Nullable <DateTime> DeactivationDate)
 {
     priceMutation.DeactivatedAt = DeactivationDate;
     return(_repository.DeactivateObject(priceMutation));
 }