Ejemplo n.º 1
0
        public void Configure(RollerType rollerType, bool enableTracker = false, int constantValue = 1)
        {
            RollTracker = enableTracker ? new DieRollTracker() : null;

            switch (rollerType)
            {
            case RollerType.Random:
                DieRoller = new RandomDieRoller(RollTracker);
                break;

            case RollerType.Crypto:
                DieRoller = new CryptoDieRoller(RollTracker);
                break;

            case RollerType.MathNet:
                DieRoller = new MathNetDieRoller(RollTracker);
                break;

            case RollerType.Constant:
                DieRoller = new ConstantDieRoller(constantValue);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(rollerType));
            }
        }
Ejemplo n.º 2
0
        public RollerType VIsInCoreIdentificationDetail(RollerType rollerType, ICoreIdentificationDetailService _coreIdentificationDetailService)
        {
            IList <CoreIdentificationDetail> details = _coreIdentificationDetailService.GetObjectsByRollerTypeId(rollerType.Id);

            if (details.Any())
            {
                rollerType.Errors.Add("Generic", "CoreIdentificationDetail tidak boleh ada yang terasosiakan dengan rollerType");
            }
            return(rollerType);
        }
Ejemplo n.º 3
0
        public RollerType VIsInRollerBuilder(RollerType rollerType, IRollerBuilderService _rollerBuilderService)
        {
            IList <RollerBuilder> list = _rollerBuilderService.GetObjectsByRollerTypeId(rollerType.Id);

            if (list.Any())
            {
                rollerType.Errors.Add("Generic", "RollerBuilder tidak boleh ada yang terasosiakan dengan rollerType");
            }
            return(rollerType);
        }
Ejemplo n.º 4
0
        public CoreIdentificationDetail VHasRollerType(CoreIdentificationDetail coreIdentificationDetail, IRollerTypeService _rollerTypeService)
        {
            RollerType rollerType = _rollerTypeService.GetObjectById(coreIdentificationDetail.RollerTypeId);

            if (rollerType == null)
            {
                coreIdentificationDetail.Errors.Add("RollerTypeId", "Tidak terasosiasi dengan rollerType");
            }
            return(coreIdentificationDetail);
        }
Ejemplo n.º 5
0
        public RollerType CreateObject(string Name, string Description)
        {
            RollerType rollerType = new RollerType
            {
                Name        = Name,
                Description = Description
            };

            return(this.CreateObject(rollerType));
        }
Ejemplo n.º 6
0
        public RollerBuilder VHasRollerType(RollerBuilder rollerBuilder, IRollerTypeService _rollerTypeService)
        {
            RollerType rollerType = _rollerTypeService.GetObjectById(rollerBuilder.RollerTypeId);

            if (rollerType == null)
            {
                rollerBuilder.Errors.Add("RollerTypeId", "Tidak terasosiasi dengan rollerType");
            }
            return(rollerBuilder);
        }
Ejemplo n.º 7
0
 public RollerType VHasUniqueName(RollerType rollerType, IRollerTypeService _rollerTypeService)
 {
     if (String.IsNullOrEmpty(rollerType.Name) || rollerType.Name.Trim() == "")
     {
         rollerType.Errors.Add("Name", "Tidak boleh kosong");
     }
     else if (_rollerTypeService.IsNameDuplicated(rollerType))
     {
         rollerType.Errors.Add("Name", "Tidak boleh diduplikasi");
     }
     return(rollerType);
 }
Ejemplo n.º 8
0
        public string PrintError(RollerType 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);
        }
Ejemplo n.º 9
0
        public dynamic Insert(RollerType model)
        {
            try
            {
                model = _rollerTypeService.CreateObject(model);
            }
            catch (Exception ex)
            {
                LOG.Error("Insert Failed", ex);
                model.Errors.Add("Insert Failed", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Ejemplo n.º 10
0
        public dynamic Delete(RollerType model)
        {
            try
            {
                var data = _rollerTypeService.GetObjectById(model.Id);
                model = _rollerTypeService.SoftDeleteObject(data, _rollerBuilderService, _coreIdentificationDetailService);
            }
            catch (Exception ex)
            {
                LOG.Error("Delete Failed", ex);
                model.Errors.Add("Delete Failed", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Ejemplo n.º 11
0
        public dynamic GetInfo(int Id)
        {
            RollerType model = new RollerType();

            try
            {
                model = _rollerTypeService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                model.Errors.Add("Generic", "Error" + ex);
            }

            return(Json(new
            {
                model
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 12
0
        public dynamic Update(RollerType model)
        {
            try
            {
                var data = _rollerTypeService.GetObjectById(model.Id);
                data.Name        = model.Name;
                data.Description = model.Description;
                model            = _rollerTypeService.UpdateObject(data);
            }
            catch (Exception ex)
            {
                LOG.Error("Update Failed", ex);
                model.Errors.Add("Update Failed", "Error : " + ex);
            }

            return(Json(new
            {
                model.Errors
            }));
        }
Ejemplo n.º 13
0
 public RollerType VUpdateObject(RollerType rollerType, IRollerTypeService _rollerTypeService)
 {
     VHasUniqueName(rollerType, _rollerTypeService);
     return(rollerType);
 }
Ejemplo n.º 14
0
        public PurchaseBuilder()
        {
            _accountService                  = new AccountService(new AccountRepository(), new AccountValidator());
            _barringService                  = new BarringService(new BarringRepository(), new BarringValidator());
            _barringOrderService             = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator());
            _barringOrderDetailService       = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator());
            _cashBankAdjustmentService       = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
            _cashBankMutationService         = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
            _cashBankService                 = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _cashMutationService             = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
            _closingService                  = new ClosingService(new ClosingRepository(), new ClosingValidator());
            _coreBuilderService              = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator());
            _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator());
            _coreIdentificationService       = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator());
            _contactService                  = new ContactService(new ContactRepository(), new ContactValidator());
            _deliveryOrderService            = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
            _deliveryOrderDetailService      = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
            _generalLedgerJournalService     = new GeneralLedgerJournalService(new GeneralLedgerJournalRepository(), new GeneralLedgerJournalValidator());
            _itemService                          = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService                      = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _machineService                       = new MachineService(new MachineRepository(), new MachineValidator());
            _payableService                       = new PayableService(new PayableRepository(), new PayableValidator());
            _paymentVoucherDetailService          = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
            _paymentVoucherService                = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
            _purchaseInvoiceDetailService         = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
            _purchaseInvoiceService               = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
            _purchaseOrderService                 = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
            _purchaseOrderDetailService           = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
            _purchaseReceivalService              = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
            _purchaseReceivalDetailService        = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
            _receivableService                    = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
            _receiptVoucherDetailService          = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
            _receiptVoucherService                = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator());
            _recoveryOrderDetailService           = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator());
            _recoveryOrderService                 = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator());
            _recoveryAccessoryDetailService       = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator());
            _rollerBuilderService                 = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator());
            _rollerTypeService                    = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator());
            _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator());
            _rollerWarehouseMutationService       = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator());
            _salesInvoiceDetailService            = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
            _salesInvoiceService                  = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
            _salesOrderService                    = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
            _salesOrderDetailService              = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
            _stockAdjustmentDetailService         = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
            _stockAdjustmentService               = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator());
            _stockMutationService                 = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
            _uomService                          = new UoMService(new UoMRepository(), new UoMValidator());
            _validCombService                    = new ValidCombService(new ValidCombRepository(), new ValidCombValidator());
            _warehouseItemService                = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
            _warehouseService                    = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
            _warehouseMutationOrderService       = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator());
            _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator());

            _priceMutationService = new PriceMutationService(new PriceMutationRepository(), new PriceMutationValidator());
            _contactGroupService  = new ContactGroupService(new ContactGroupRepository(), new ContactGroupValidator());

            typeAccessory    = _itemTypeService.CreateObject("Accessory", "Accessory");
            typeBar          = _itemTypeService.CreateObject("Bar", "Bar");
            typeBarring      = _itemTypeService.CreateObject("Barring", "Barring", true);
            typeBearing      = _itemTypeService.CreateObject("Bearing", "Bearing");
            typeBlanket      = _itemTypeService.CreateObject("Blanket", "Blanket");
            typeChemical     = _itemTypeService.CreateObject("Chemical", "Chemical");
            typeCompound     = _itemTypeService.CreateObject("Compound", "Compound");
            typeConsumable   = _itemTypeService.CreateObject("Consumable", "Consumable");
            typeCore         = _itemTypeService.CreateObject("Core", "Core", true);
            typeGlue         = _itemTypeService.CreateObject("Glue", "Glue");
            typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking");
            typeRoller       = _itemTypeService.CreateObject("Roller", "Roller", true);

            typeDamp       = _rollerTypeService.CreateObject("Damp", "Damp");
            typeFoundDT    = _rollerTypeService.CreateObject("Found DT", "Found DT");
            typeInkFormX   = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X");
            typeInkDistD   = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D");
            typeInkDistM   = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M");
            typeInkDistE   = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E");
            typeInkDuctB   = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B");
            typeInkDistH   = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H");
            typeInkFormW   = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W");
            typeInkDistHQ  = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ");
            typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ");
            typeInkFormY   = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y");

            baseGroup = _contactGroupService.CreateObject(Core.Constants.Constant.GroupType.Base, "Base Group", true);

            if (!_accountService.GetLegacyObjects().Any())
            {
                Asset = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Asset", Code = Constant.AccountCode.Asset, LegacyCode = Constant.AccountLegacyCode.Asset, Level = 1, Group = Constant.AccountGroup.Asset, IsLegacy = true
                }, _accountService);
                CashBank = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank", Code = Constant.AccountCode.CashBank, LegacyCode = Constant.AccountLegacyCode.CashBank, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                AccountReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Receivable", IsLeaf = true, Code = Constant.AccountCode.AccountReceivable, LegacyCode = Constant.AccountLegacyCode.AccountReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                GBCHReceivable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Receivable", IsLeaf = true, Code = Constant.AccountCode.GBCHReceivable, LegacyCode = Constant.AccountLegacyCode.GBCHReceivable, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);
                Inventory = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Inventory", IsLeaf = true, Code = Constant.AccountCode.Inventory, LegacyCode = Constant.AccountLegacyCode.Inventory, Level = 2, Group = Constant.AccountGroup.Asset, ParentId = Asset.Id, IsLegacy = true
                }, _accountService);

                Expense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Expense", Code = Constant.AccountCode.Expense, LegacyCode = Constant.AccountLegacyCode.Expense, Level = 1, Group = Constant.AccountGroup.Expense, IsLegacy = true
                }, _accountService);
                CashBankAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "CashBank Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.CashBankAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.CashBankAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                COGS = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Cost Of Goods Sold", IsLeaf = true, Code = Constant.AccountCode.COGS, LegacyCode = Constant.AccountLegacyCode.COGS, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                Discount = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Discount", IsLeaf = true, Code = Constant.AccountCode.Discount, LegacyCode = Constant.AccountLegacyCode.Discount, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                SalesAllowance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Sales Allowance", IsLeaf = true, Code = Constant.AccountCode.SalesAllowance, LegacyCode = Constant.AccountLegacyCode.SalesAllowance, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);
                StockAdjustmentExpense = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Stock Adjustment Expense", IsLeaf = true, Code = Constant.AccountCode.StockAdjustmentExpense, LegacyCode = Constant.AccountLegacyCode.StockAdjustmentExpense, Level = 2, Group = Constant.AccountGroup.Expense, ParentId = Expense.Id, IsLegacy = true
                }, _accountService);

                Liability = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Liability", Code = Constant.AccountCode.Liability, LegacyCode = Constant.AccountLegacyCode.Liability, Level = 1, Group = Constant.AccountGroup.Liability, IsLegacy = true
                }, _accountService);
                AccountPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Account Payable", IsLeaf = true, Code = Constant.AccountCode.AccountPayable, LegacyCode = Constant.AccountLegacyCode.AccountPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GBCHPayable = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "GBCH Payable", IsLeaf = true, Code = Constant.AccountCode.GBCHPayable, LegacyCode = Constant.AccountLegacyCode.GBCHPayable, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);
                GoodsPendingClearance = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Goods Pending Clearance", IsLeaf = true, Code = Constant.AccountCode.GoodsPendingClearance, LegacyCode = Constant.AccountLegacyCode.GoodsPendingClearance, Level = 2, Group = Constant.AccountGroup.Liability, ParentId = Liability.Id, IsLegacy = true
                }, _accountService);

                Equity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity", Code = Constant.AccountCode.Equity, LegacyCode = Constant.AccountLegacyCode.Equity, Level = 1, Group = Constant.AccountGroup.Equity, IsLegacy = true
                }, _accountService);
                OwnersEquity = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Owners Equity", Code = Constant.AccountCode.OwnersEquity, LegacyCode = Constant.AccountLegacyCode.OwnersEquity, Level = 2, Group = Constant.AccountGroup.Equity, ParentId = Equity.Id, IsLegacy = true
                }, _accountService);
                EquityAdjustment = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Equity Adjustment", IsLeaf = true, Code = Constant.AccountCode.EquityAdjustment, LegacyCode = Constant.AccountLegacyCode.EquityAdjustment, Level = 3, Group = Constant.AccountGroup.Equity, ParentId = OwnersEquity.Id, IsLegacy = true
                }, _accountService);

                Revenue = _accountService.CreateLegacyObject(new Account()
                {
                    Name = "Revenue", IsLeaf = true, Code = Constant.AccountCode.Revenue, LegacyCode = Constant.AccountLegacyCode.Revenue, Level = 1, Group = Constant.AccountGroup.Revenue, IsLegacy = true
                }, _accountService);
            }
        }
Ejemplo n.º 15
0
        void rollertype_validation()
        {
            it["validates_rollertypes"] = () =>
            {
                d.typeDamp.Errors.Count().should_be(0);
                d.typeFoundDT.Errors.Count().should_be(0);
                d.typeInkFormX.Errors.Count().should_be(0);
                d.typeInkDistD.Errors.Count().should_be(0);
                d.typeInkDistM.Errors.Count().should_be(0);
                d.typeInkDistE.Errors.Count().should_be(0);
                d.typeInkDuctB.Errors.Count().should_be(0);
                d.typeInkDistH.Errors.Count().should_be(0);
                d.typeInkFormW.Errors.Count().should_be(0);
                d.typeInkDistHQ.Errors.Count().should_be(0);
                d.typeDampFormDQ.Errors.Count().should_be(0);
                d.typeInkFormY.Errors.Count().should_be(0);
            };

            it["rollertype_with_existingname"] = () =>
            {
                RollerType typecopyDamp = d._rollerTypeService.CreateObject("Damp", "Damp");
                typecopyDamp.Errors.Count().should_not_be(0);
            };

            it["delete_rollertype"] = () =>
            {
                d.typeDamp = d._rollerTypeService.SoftDeleteObject(d.typeDamp, d._rollerBuilderService, d._coreIdentificationDetailService);
                d.typeDamp.Errors.Count().should_be(0);
            };

            context["when_deleting_rollertype"] = () =>
            {
                before = () =>
                {
                    d.itemCompound = new Item()
                    {
                        ItemTypeId = d._itemTypeService.GetObjectByName("Compound").Id,
                        Sku        = "Cmp10001",
                        Name       = "Cmp 10001",
                        Category   = "cmp",
                        UoMId      = d.Pcs.Id
                    };
                    d.itemCompound = d._itemService.CreateObject(d.itemCompound, d._uomService, d._itemTypeService, d._warehouseItemService, d._warehouseService);
                    d._itemService.AdjustQuantity(d.itemCompound, 2);
                    d._warehouseItemService.AdjustQuantity(d._warehouseItemService.FindOrCreateObject(d.localWarehouse.Id, d.itemCompound.Id), 2);

                    d.contact = d._contactService.CreateObject("Abbey", "1 Abbey St", "001234567", "Daddy", "001234888", "*****@*****.**");

                    d.machine = new Machine()
                    {
                        Code        = "M00001",
                        Name        = "Machine 00001",
                        Description = "Machine"
                    };
                    d.machine     = d._machineService.CreateObject(d.machine);
                    d.coreBuilder = new CoreBuilder()
                    {
                        BaseSku     = "CB00001",
                        SkuNewCore  = "CB00001N",
                        SkuUsedCore = "CB00001U",
                        Name        = "CoreBuilder00001",
                        Category    = "X",
                        UoMId       = d.Pcs.Id
                    };
                    d.coreBuilder        = d._coreBuilderService.CreateObject(d.coreBuilder, d._uomService, d._itemService, d._itemTypeService, d._warehouseItemService, d._warehouseService);
                    d.coreIdentification = new CoreIdentification()
                    {
                        ContactId      = d.contact.Id,
                        Code           = "CI0001",
                        Quantity       = 1,
                        IdentifiedDate = DateTime.Now,
                        WarehouseId    = d.localWarehouse.Id
                    };
                    d.coreIdentification = d._coreIdentificationService.CreateObject(d.coreIdentification, d._contactService);
                };

                it["delete_rollertype_with_coreidentificationdetail"] = () =>
                {
                    d.coreIdentificationDetail = new CoreIdentificationDetail()
                    {
                        CoreIdentificationId = d.coreIdentification.Id,
                        DetailId             = 1,
                        MaterialCase         = 2,
                        CoreBuilderId        = d.coreBuilder.Id,
                        RollerTypeId         = d._rollerTypeService.GetObjectByName("Found DT").Id,
                        MachineId            = d.machine.Id,
                        RD = 12,
                        CD = 12,
                        RL = 12,
                        WL = 12,
                        TL = 12
                    };
                    d.coreIdentificationDetail = d._coreIdentificationDetailService.CreateObject(d.coreIdentificationDetail, d._coreIdentificationService,
                                                                                                 d._coreBuilderService, d._rollerTypeService, d._machineService);
                    d.typeFoundDT = d._rollerTypeService.SoftDeleteObject(d.typeFoundDT, d._rollerBuilderService, d._coreIdentificationDetailService);
                    d.typeFoundDT.Errors.Count().should_not_be(0);
                };

                it["delete_rollertype_with_rollerbuilder"] = () =>
                {
                    d.rollerBuilder = new RollerBuilder()
                    {
                        BaseSku           = "RB0001",
                        SkuRollerNewCore  = "RB0001N",
                        SkuRollerUsedCore = "RB0001U",
                        Name          = "Roller 0001",
                        Category      = "0001",
                        RD            = 12,
                        CD            = 13,
                        RL            = 14,
                        TL            = 15,
                        WL            = 16,
                        CompoundId    = d.itemCompound.Id,
                        CoreBuilderId = d.coreBuilder.Id,
                        MachineId     = d.machine.Id,
                        RollerTypeId  = d._rollerTypeService.GetObjectByName("Damp").Id,
                        UoMId         = d.Pcs.Id
                    };
                    d.rollerBuilder = d._rollerBuilderService.CreateObject(d.rollerBuilder, d._machineService, d._uomService, d._itemService, d._itemTypeService,
                                                                           d._coreBuilderService, d._rollerTypeService, d._warehouseItemService, d._warehouseService);
                    d.typeDamp = d._rollerTypeService.SoftDeleteObject(d.typeDamp, d._rollerBuilderService, d._coreIdentificationDetailService);
                    d.typeDamp.Errors.Count().should_not_be(0);
                };
            };
        }
Ejemplo n.º 16
0
        public PurchaseBuilder()
        {
            _barringService                  = new BarringService(new BarringRepository(), new BarringValidator());
            _barringOrderService             = new BarringOrderService(new BarringOrderRepository(), new BarringOrderValidator());
            _barringOrderDetailService       = new BarringOrderDetailService(new BarringOrderDetailRepository(), new BarringOrderDetailValidator());
            _cashBankAdjustmentService       = new CashBankAdjustmentService(new CashBankAdjustmentRepository(), new CashBankAdjustmentValidator());
            _cashBankMutationService         = new CashBankMutationService(new CashBankMutationRepository(), new CashBankMutationValidator());
            _cashBankService                 = new CashBankService(new CashBankRepository(), new CashBankValidator());
            _cashMutationService             = new CashMutationService(new CashMutationRepository(), new CashMutationValidator());
            _coreBuilderService              = new CoreBuilderService(new CoreBuilderRepository(), new CoreBuilderValidator());
            _coreIdentificationDetailService = new CoreIdentificationDetailService(new CoreIdentificationDetailRepository(), new CoreIdentificationDetailValidator());
            _coreIdentificationService       = new CoreIdentificationService(new CoreIdentificationRepository(), new CoreIdentificationValidator());
            _contactService                  = new ContactService(new ContactRepository(), new ContactValidator());
            _deliveryOrderService            = new DeliveryOrderService(new DeliveryOrderRepository(), new DeliveryOrderValidator());
            _deliveryOrderDetailService      = new DeliveryOrderDetailService(new DeliveryOrderDetailRepository(), new DeliveryOrderDetailValidator());
            _itemService                          = new ItemService(new ItemRepository(), new ItemValidator());
            _itemTypeService                      = new ItemTypeService(new ItemTypeRepository(), new ItemTypeValidator());
            _machineService                       = new MachineService(new MachineRepository(), new MachineValidator());
            _payableService                       = new PayableService(new PayableRepository(), new PayableValidator());
            _paymentVoucherDetailService          = new PaymentVoucherDetailService(new PaymentVoucherDetailRepository(), new PaymentVoucherDetailValidator());
            _paymentVoucherService                = new PaymentVoucherService(new PaymentVoucherRepository(), new PaymentVoucherValidator());
            _purchaseInvoiceDetailService         = new PurchaseInvoiceDetailService(new PurchaseInvoiceDetailRepository(), new PurchaseInvoiceDetailValidator());
            _purchaseInvoiceService               = new PurchaseInvoiceService(new PurchaseInvoiceRepository(), new PurchaseInvoiceValidator());
            _purchaseOrderService                 = new PurchaseOrderService(new PurchaseOrderRepository(), new PurchaseOrderValidator());
            _purchaseOrderDetailService           = new PurchaseOrderDetailService(new PurchaseOrderDetailRepository(), new PurchaseOrderDetailValidator());
            _purchaseReceivalService              = new PurchaseReceivalService(new PurchaseReceivalRepository(), new PurchaseReceivalValidator());
            _purchaseReceivalDetailService        = new PurchaseReceivalDetailService(new PurchaseReceivalDetailRepository(), new PurchaseReceivalDetailValidator());
            _receivableService                    = new ReceivableService(new ReceivableRepository(), new ReceivableValidator());
            _receiptVoucherDetailService          = new ReceiptVoucherDetailService(new ReceiptVoucherDetailRepository(), new ReceiptVoucherDetailValidator());
            _receiptVoucherService                = new ReceiptVoucherService(new ReceiptVoucherRepository(), new ReceiptVoucherValidator());
            _recoveryOrderDetailService           = new RecoveryOrderDetailService(new RecoveryOrderDetailRepository(), new RecoveryOrderDetailValidator());
            _recoveryOrderService                 = new RecoveryOrderService(new RecoveryOrderRepository(), new RecoveryOrderValidator());
            _recoveryAccessoryDetailService       = new RecoveryAccessoryDetailService(new RecoveryAccessoryDetailRepository(), new RecoveryAccessoryDetailValidator());
            _rollerBuilderService                 = new RollerBuilderService(new RollerBuilderRepository(), new RollerBuilderValidator());
            _rollerTypeService                    = new RollerTypeService(new RollerTypeRepository(), new RollerTypeValidator());
            _rollerWarehouseMutationDetailService = new RollerWarehouseMutationDetailService(new RollerWarehouseMutationDetailRepository(), new RollerWarehouseMutationDetailValidator());
            _rollerWarehouseMutationService       = new RollerWarehouseMutationService(new RollerWarehouseMutationRepository(), new RollerWarehouseMutationValidator());
            _salesInvoiceDetailService            = new SalesInvoiceDetailService(new SalesInvoiceDetailRepository(), new SalesInvoiceDetailValidator());
            _salesInvoiceService                  = new SalesInvoiceService(new SalesInvoiceRepository(), new SalesInvoiceValidator());
            _salesOrderService                    = new SalesOrderService(new SalesOrderRepository(), new SalesOrderValidator());
            _salesOrderDetailService              = new SalesOrderDetailService(new SalesOrderDetailRepository(), new SalesOrderDetailValidator());
            _stockAdjustmentDetailService         = new StockAdjustmentDetailService(new StockAdjustmentDetailRepository(), new StockAdjustmentDetailValidator());
            _stockAdjustmentService               = new StockAdjustmentService(new StockAdjustmentRepository(), new StockAdjustmentValidator());
            _stockMutationService                 = new StockMutationService(new StockMutationRepository(), new StockMutationValidator());
            _uomService                          = new UoMService(new UoMRepository(), new UoMValidator());
            _warehouseItemService                = new WarehouseItemService(new WarehouseItemRepository(), new WarehouseItemValidator());
            _warehouseService                    = new WarehouseService(new WarehouseRepository(), new WarehouseValidator());
            _warehouseMutationOrderService       = new WarehouseMutationOrderService(new WarehouseMutationOrderRepository(), new WarehouseMutationOrderValidator());
            _warehouseMutationOrderDetailService = new WarehouseMutationOrderDetailService(new WarehouseMutationOrderDetailRepository(), new WarehouseMutationOrderDetailValidator());

            typeAccessory    = _itemTypeService.CreateObject("Accessory", "Accessory");
            typeBar          = _itemTypeService.CreateObject("Bar", "Bar");
            typeBarring      = _itemTypeService.CreateObject("Barring", "Barring", true);
            typeBearing      = _itemTypeService.CreateObject("Bearing", "Bearing");
            typeBlanket      = _itemTypeService.CreateObject("Blanket", "Blanket");
            typeChemical     = _itemTypeService.CreateObject("Chemical", "Chemical");
            typeCompound     = _itemTypeService.CreateObject("Compound", "Compound");
            typeConsumable   = _itemTypeService.CreateObject("Consumable", "Consumable");
            typeCore         = _itemTypeService.CreateObject("Core", "Core", true);
            typeGlue         = _itemTypeService.CreateObject("Glue", "Glue");
            typeUnderpacking = _itemTypeService.CreateObject("Underpacking", "Underpacking");
            typeRoller       = _itemTypeService.CreateObject("Roller", "Roller", true);

            typeDamp       = _rollerTypeService.CreateObject("Damp", "Damp");
            typeFoundDT    = _rollerTypeService.CreateObject("Found DT", "Found DT");
            typeInkFormX   = _rollerTypeService.CreateObject("Ink Form X", "Ink Form X");
            typeInkDistD   = _rollerTypeService.CreateObject("Ink Dist D", "Ink Dist D");
            typeInkDistM   = _rollerTypeService.CreateObject("Ink Dist M", "Ink Dist M");
            typeInkDistE   = _rollerTypeService.CreateObject("Ink Dist E", "Ink Dist E");
            typeInkDuctB   = _rollerTypeService.CreateObject("Ink Duct B", "Ink Duct B");
            typeInkDistH   = _rollerTypeService.CreateObject("Ink Dist H", "Ink Dist H");
            typeInkFormW   = _rollerTypeService.CreateObject("Ink Form W", "Ink Form W");
            typeInkDistHQ  = _rollerTypeService.CreateObject("Ink Dist HQ", "Ink Dist HQ");
            typeDampFormDQ = _rollerTypeService.CreateObject("Damp Form DQ", "Damp Form DQ");
            typeInkFormY   = _rollerTypeService.CreateObject("Ink Form Y", "Ink Form Y");
        }
Ejemplo n.º 17
0
 public RollerType CreateObject(RollerType rollerType)
 {
     rollerType.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(rollerType, this) ? _repository.CreateObject(rollerType) : rollerType);
 }
Ejemplo n.º 18
0
 public RollerType UpdateObject(RollerType rollerType)
 {
     return(rollerType = _validator.ValidUpdateObject(rollerType, this) ? _repository.UpdateObject(rollerType) : rollerType);
 }
Ejemplo n.º 19
0
        public bool isValid(RollerType obj)
        {
            bool isValid = !obj.Errors.Any();

            return(isValid);
        }
Ejemplo n.º 20
0
 public bool ValidDeleteObject(RollerType rollerType, IRollerBuilderService _rollerBuilderService, ICoreIdentificationDetailService _coreIdentificationDetailService)
 {
     rollerType.Errors.Clear();
     VDeleteObject(rollerType, _rollerBuilderService, _coreIdentificationDetailService);
     return(isValid(rollerType));
 }
Ejemplo n.º 21
0
 public bool ValidUpdateObject(RollerType rollerType, IRollerTypeService _rollerTypeService)
 {
     rollerType.Errors.Clear();
     VUpdateObject(rollerType, _rollerTypeService);
     return(isValid(rollerType));
 }
Ejemplo n.º 22
0
 public bool ValidCreateObject(RollerType rollerType, IRollerTypeService _rollerTypeService)
 {
     VCreateObject(rollerType, _rollerTypeService);
     return(isValid(rollerType));
 }
Ejemplo n.º 23
0
 public RollerType VDeleteObject(RollerType rollerType, IRollerBuilderService _rollerBuilderService, ICoreIdentificationDetailService _coreIdentificationDetailService)
 {
     VIsInCoreIdentificationDetail(rollerType, _coreIdentificationDetailService);
     VIsInRollerBuilder(rollerType, _rollerBuilderService);
     return(rollerType);
 }
Ejemplo n.º 24
0
 public RollerType SoftDeleteObject(RollerType rollerType, IRollerBuilderService _rollerBuilderService, ICoreIdentificationDetailService _coreIdentificationDetailService)
 {
     return(rollerType = _validator.ValidDeleteObject(rollerType, _rollerBuilderService, _coreIdentificationDetailService) ? _repository.SoftDeleteObject(rollerType) : rollerType);
 }
Ejemplo n.º 25
0
        public bool IsNameDuplicated(RollerType rollerType)
        {
            IQueryable <RollerType> types = _repository.FindAll(x => x.Name == rollerType.Name && !x.IsDeleted && x.Id != rollerType.Id);

            return(types.Count() > 0 ? true : false);
        }