Example #1
0
 public DispatchController(IDispatchAllocationService dispatchAllocationService, IDispatchService dispatchService,
                           IUserProfileService userProfileService, IOtherDispatchAllocationService otherDispatchAllocationService,
                           IDispatchDetailService dispatchDetailService, IUnitService unitService, ICommodityTypeService commodityTypeService,
                           IProgramService programService, ITransporterService transporterService, IPeriodService periodService,
                           ICommodityService commodityService, ITransactionService transactionService, IStoreService storeService,
                           IAdminUnitService adminUnitService, IHubService hubService, IFDPService fdpService,
                           IProjectCodeService projectCodeService, IShippingInstructionService shippingInstructionService)
 {
     _dispatchAllocationService      = dispatchAllocationService;
     _dispatchService                = dispatchService;
     _userProfileService             = userProfileService;
     _otherDispatchAllocationService = otherDispatchAllocationService;
     _dispatchDetailService          = dispatchDetailService;
     _unitService                = unitService;
     _commodityTypeService       = commodityTypeService;
     _programService             = programService;
     _transporterService         = transporterService;
     _periodService              = periodService;
     _commodityService           = commodityService;
     _transactionService         = transactionService;
     _storeService               = storeService;
     _adminUnitService           = adminUnitService;
     _hubService                 = hubService;
     _fdpService                 = fdpService;
     _projectCodeService         = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
 }
 public LossesAndAdjustmentsController(IUserProfileService userProfileService,
                                         ICommodityService commodityService,
                                         IStoreService storeService,
                                         IProgramService programService,
                                         IHubService hubService,
                                         IUnitService unitService,
                                         IAdjustmentReasonService adjustmentReasonService,
                                         IAdjustmentService adjustmentService,
                                         ITransactionService transactionService,
                                         IProjectCodeService projectCodeService,
                                         IShippingInstructionService shippingInstructionService)
     : base(userProfileService)
 {
     _userProfileService = userProfileService;
     _commodityService = commodityService;
     _storeService = storeService;
     _programService = programService;
     _hubService = hubService;
     _unitService = unitService;
     _adjustmentReasonService = adjustmentReasonService;
     _adjustmentService = adjustmentService;
     _TransactionService = transactionService;
     _projectCodeService = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
 }
 public LossesAndAdjustmentsController(IUserProfileService userProfileService,
                                       ICommodityService commodityService,
                                       IStoreService storeService,
                                       IProgramService programService,
                                       IHubService hubService,
                                       IUnitService unitService,
                                       IAdjustmentReasonService adjustmentReasonService,
                                       IAdjustmentService adjustmentService,
                                       ITransactionService transactionService,
                                       IProjectCodeService projectCodeService,
                                       IShippingInstructionService shippingInstructionService)
     : base(userProfileService)
 {
     _userProfileService         = userProfileService;
     _commodityService           = commodityService;
     _storeService               = storeService;
     _programService             = programService;
     _hubService                 = hubService;
     _unitService                = unitService;
     _adjustmentReasonService    = adjustmentReasonService;
     _adjustmentService          = adjustmentService;
     _TransactionService         = transactionService;
     _projectCodeService         = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
 }
 public ProjectAllocationController(IRegionalRequestService reliefRequistionService
                                    , IFDPService fdpService
                                    , IAdminUnitService adminUnitService,
                                    IProgramService programService,
                                    ICommodityService commodityService,
                                    IRegionalRequestDetailService reliefRequisitionDetailService,
                                    IProjectCodeAllocationService projectCodeAllocationService,
                                    IProjectCodeService projectCodeService,
                                    IShippingInstructionService shippingInstructionService,
                                    IHubService hubService,
                                    IHubAllocationService hubAllocationService,
                                    ILog log,
                                    IReliefRequisitionService requisitionService, ITransactionService transactionservice, ILedgerService ledgerService)
 {
     this._regionalRequestService         = reliefRequistionService;
     this._adminUnitService               = adminUnitService;
     this._commodityService               = commodityService;
     this._fdpService                     = fdpService;
     this._programService                 = programService;
     this._reliefRequisitionDetailService = reliefRequisitionDetailService;
     this._projectCodeAllocationService   = projectCodeAllocationService;
     this._projectCodeService             = projectCodeService;
     this._shippingInstructionService     = shippingInstructionService;
     this._hubService                     = hubService;
     this._hubAllocationService           = hubAllocationService;
     this._requisitionService             = requisitionService;
     this._transactionService             = transactionservice;
     this._ledgerService                  = ledgerService;
     this._log = log;
 }
 public DispatchAllocationController(IDispatchAllocationService dispatchAllocationService,
                                     IUserProfileService userProfileService,
                                     IOtherDispatchAllocationService otherDispatchAllocationService,
                                     IShippingInstructionService shippingInstructionService,
                                     IProjectCodeService projectCodeService,
                                     ITransporterService transporterService,
                                     ICommonService commonService,
                                     IAdminUnitService adminUnitService,
                                     IFDPService fdpService,
                                     IHubService hubService,
                                      ICommodityTypeService commodityTypeService)
     : base(userProfileService)
 {
     this._dispatchAllocationService = dispatchAllocationService;
     this._userProfileService = userProfileService;
     this._otherDispatchAllocationService = otherDispatchAllocationService;
     this._projectCodeService = projectCodeService;
     this._shippingInstructionService = shippingInstructionService;
     this._transporterService = transporterService;
     this._adminUnitService = adminUnitService;
     this._fdpService = fdpService;
     this._commonService = commonService;
     this._hubService = hubService;
     this._commodityTypeService = commodityTypeService;
 }
Example #6
0
 public ReceiveController(IReceiveService receiveService,IGiftCertificateService giftCertificateService,
                          IReceiptAllocationService receiptAllocationService,IUserProfileService userProfileService,
                          ICommodityTypeService commodityTypeService ,IReceiveDetailService receiveDetailService,
                          ICommodityService commodityService,IStoreService storeService,ITransactionService transactionService,
                          IUnitService unitService,IShippingInstructionService shippingInstructionService,IHubService hubService,
                          ICommodityGradeService commodityGradeService,IProgramService programService,ITransporterService transporterService,
                          ICommoditySourceService commoditySourceService, IDonorService donorService)
     : base(userProfileService)
 {
     _receiveService = receiveService;
     _giftCertificateService = giftCertificateService;
     _receiptAllocationService = receiptAllocationService;
     _userProfileService = userProfileService;
     _commodityTypeService = commodityTypeService;
     _receiveDetailService = receiveDetailService;
     _commodityService = commodityService;
     _storeService = storeService;
     _transactionService = transactionService;
     _unitService = unitService;
     _shippingInstructionService = shippingInstructionService;
     _hubService = hubService;
     _commodityGradeService = commodityGradeService;
     _programService = programService;
     _transporterService = transporterService;
     _commoditySourceService=commoditySourceService;
     _donorService = donorService;
 }
Example #7
0
 public DispatchController(IDispatchAllocationService dispatchAllocationService, IDispatchService dispatchService,
     IUserProfileService userProfileService, IOtherDispatchAllocationService otherDispatchAllocationService,
     IDispatchDetailService dispatchDetailService, IUnitService unitService, ICommodityTypeService commodityTypeService,
     IProgramService programService, ITransporterService transporterService, IPeriodService periodService, 
     ICommodityService commodityService, ITransactionService transactionService, IStoreService storeService,
     IAdminUnitService adminUnitService, IHubService hubService, IFDPService fdpService,
     IProjectCodeService projectCodeService, IShippingInstructionService shippingInstructionService, 
     ISMSGatewayService smsGatewayService, IContactService contactService, ISMSService smsService)
     : base(userProfileService)
 {
     _dispatchAllocationService = dispatchAllocationService;
     _dispatchService = dispatchService;
     _userProfileService = userProfileService;
     _otherDispatchAllocationService = otherDispatchAllocationService;
     _dispatchDetailService = dispatchDetailService;
     _unitService = unitService;
     _commodityTypeService = commodityTypeService;
     _programService = programService;
     _transporterService = transporterService;
     _periodService = periodService;
     _commodityService = commodityService;
     _transactionService = transactionService;
     _storeService = storeService;
     _adminUnitService = adminUnitService;
     _hubService = hubService;
     _fdpService = fdpService;
     _projectCodeService = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
     _smsGatewayService = smsGatewayService;
     _contactService = contactService;
     _smsService = smsService;
 }
Example #8
0
 public TransactionService(IUnitOfWork unitOfWork, IAccountService accountService, IShippingInstructionService shippingInstructionService, IProjectCodeService projectCodeService)
 {
     this._unitOfWork = unitOfWork;
     this._accountService = accountService;
     this._shippingInstructionService = shippingInstructionService;
     this._projectCodeService = projectCodeService;
 }
Example #9
0
 public DispatchAllocationController(IDispatchAllocationService dispatchAllocationService,
                                     IUserProfileService userProfileService,
                                     IOtherDispatchAllocationService otherDispatchAllocationService,
                                     IShippingInstructionService shippingInstructionService,
                                     IProjectCodeService projectCodeService,
                                     ITransporterService transporterService,
                                     ICommonService commonService,
                                     IAdminUnitService adminUnitService,
                                     IFDPService fdpService,
                                     IHubService hubService,
                                     ICommodityTypeService commodityTypeService)
     : base(userProfileService)
 {
     this._dispatchAllocationService      = dispatchAllocationService;
     this._userProfileService             = userProfileService;
     this._otherDispatchAllocationService = otherDispatchAllocationService;
     this._projectCodeService             = projectCodeService;
     this._shippingInstructionService     = shippingInstructionService;
     this._transporterService             = transporterService;
     this._adminUnitService     = adminUnitService;
     this._fdpService           = fdpService;
     this._commonService        = commonService;
     this._hubService           = hubService;
     this._commodityTypeService = commodityTypeService;
 }
 public ProjectAllocationController(IRegionalRequestService reliefRequistionService
    , IFDPService fdpService
     , IAdminUnitService adminUnitService,
     IProgramService programService,
     ICommodityService commodityService,
     IRegionalRequestDetailService reliefRequisitionDetailService,
     IProjectCodeAllocationService projectCodeAllocationService, 
     IProjectCodeService projectCodeService,
     IShippingInstructionService shippingInstructionService, 
     IHubService hubService, 
     IHubAllocationService hubAllocationService,
     ILog log,
     IReliefRequisitionService requisitionService, ITransactionService transactionservice, ILedgerService ledgerService)
 {
     this._regionalRequestService = reliefRequistionService;
     this._adminUnitService = adminUnitService;
     this._commodityService = commodityService;
     this._fdpService = fdpService;
     this._programService = programService;
     this._reliefRequisitionDetailService = reliefRequisitionDetailService;
     this._projectCodeAllocationService = projectCodeAllocationService;
     this._projectCodeService = projectCodeService;
     this._shippingInstructionService = shippingInstructionService;
     this._hubService = hubService;
     this._hubAllocationService = hubAllocationService;
     this._requisitionService = requisitionService;
     this._transactionService = transactionservice;
        this._ledgerService = ledgerService;
     this._log = log;
 }
Example #11
0
 public LocalPurchaseController(ILocalPurchaseService localPurchaseService, ICommonService commonService, ILocalPurchaseDetailService localPurchaseDetailService,
                                IGiftCertificateService giftCertificateService, IShippingInstructionService shippingInstructionService)
 {
     _localPurchaseService       = localPurchaseService;
     _commonService              = commonService;
     _localPurchaseDetailService = localPurchaseDetailService;
     _giftCertificateService     = giftCertificateService;
     _shippingInstructionService = shippingInstructionService;
 }
 public LocalPurchaseController( ILocalPurchaseService localPurchaseService,ICommonService commonService,ILocalPurchaseDetailService localPurchaseDetailService,
                                 IGiftCertificateService giftCertificateService,IShippingInstructionService shippingInstructionService)
 {
     _localPurchaseService = localPurchaseService;
     _commonService = commonService;
     _localPurchaseDetailService = localPurchaseDetailService;
     _giftCertificateService = giftCertificateService;
     _shippingInstructionService = shippingInstructionService;
 }
Example #13
0
 public GiftCertificateController(IGiftCertificateService giftCertificateService, IGiftCertificateDetailService giftCertificateDetailService,
                                  ICommonService commonService, ITransactionService transactionService, ILetterTemplateService letterTemplateService,
                                  IUnitOfWork unitofwork,IUserAccountService userAccountService,IShippingInstructionService shippingInstructionService)
 {
     _giftCertificateService = giftCertificateService;
     _giftCertificateDetailService = giftCertificateDetailService;
     _commonService = commonService;
     _transactionService = transactionService;
     _letterTemplateService = letterTemplateService;
     _unitofwork = unitofwork;
     _userAccountService = userAccountService;
     _shippingInstructionService = shippingInstructionService;
 }
 public GiftCertificateController(IGiftCertificateService giftCertificateService, IGiftCertificateDetailService giftCertificateDetailService,
                                  ICommonService commonService, ITransactionService transactionService, ILetterTemplateService letterTemplateService,
                                  IUnitOfWork unitofwork, IUserAccountService userAccountService, IShippingInstructionService shippingInstructionService)
 {
     _giftCertificateService       = giftCertificateService;
     _giftCertificateDetailService = giftCertificateDetailService;
     _commonService              = commonService;
     _transactionService         = transactionService;
     _letterTemplateService      = letterTemplateService;
     _unitofwork                 = unitofwork;
     _userAccountService         = userAccountService;
     _shippingInstructionService = shippingInstructionService;
 }
 //
 // GET: /InternalMovement/
 public InternalMovementController(IUserProfileService userProfileService, IInternalMovementService internalMovementService, 
     ITransactionService transactionService, IStoreService storeService, IProjectCodeService projectCodeService,
     IShippingInstructionService shippingInstructionService, ICommodityService commodityService, IHubService hubService,
     IProgramService programService, IUnitService unitService, IDetailService detailService)
 {
     _userProfileService = userProfileService;
     _internalMovementService = internalMovementService;
     _transactionService = transactionService;
     _storeService = storeService;
     _projectCodeService = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
     _commodityService = commodityService;
     _hubService = hubService;
     _programService = programService;
     _unitService = unitService;
     _detailService = detailService;
 }
Example #16
0
 //
 // GET: /InternalMovement/
 public InternalMovementController(IUserProfileService userProfileService, IInternalMovementService internalMovementService,
                                   ITransactionService transactionService, IStoreService storeService, IProjectCodeService projectCodeService,
                                   IShippingInstructionService shippingInstructionService, ICommodityService commodityService, IHubService hubService,
                                   IProgramService programService, IUnitService unitService, IDetailService detailService)
 {
     _userProfileService         = userProfileService;
     _internalMovementService    = internalMovementService;
     _transactionService         = transactionService;
     _storeService               = storeService;
     _projectCodeService         = projectCodeService;
     _shippingInstructionService = shippingInstructionService;
     _commodityService           = commodityService;
     _hubService     = hubService;
     _programService = programService;
     _unitService    = unitService;
     _detailService  = detailService;
 }
        //
        // GET: /StockManagement/
        public StockManagementController(IUserProfileService userProfileService, IProgramService programService,
                                         ICommodityTypeService commodityTypeService, ICommoditySourceService commoditySourceService,
                                         IProjectCodeService projectCodeService, IShippingInstructionService shippingInstructionService,
                                         IReceiveService receiveService, IStoreService storeService, IHubService hubService,
                                         IAdminUnitService adminUnitService, IDispatchAllocationService dispatchAllocationService, IDonorService donorService)
        {
            _userProfileService         = userProfileService;
            _programService             = programService;
            _commodityTypeService       = commodityTypeService;
            _commoditySourceService     = commoditySourceService;
            _projectCodeService         = projectCodeService;
            _shippingInstructionService = shippingInstructionService;
            _receiveService             = receiveService;

            _storeService              = storeService;
            _hubService                = hubService;
            _adminUnitService          = adminUnitService;
            _dispatchAllocationService = dispatchAllocationService;
            _donorService              = donorService;
        }
        //
        // GET: /StockManagement/
        public StockManagementController(IUserProfileService userProfileService, IProgramService programService,
            ICommodityTypeService commodityTypeService, ICommoditySourceService commoditySourceService, 
            IProjectCodeService projectCodeService, IShippingInstructionService shippingInstructionService, 
            IReceiveService receiveService, IStoreService storeService, IHubService hubService,
            IAdminUnitService adminUnitService, IDispatchAllocationService dispatchAllocationService, IDonorService donorService)
        {
            _userProfileService = userProfileService;
            _programService = programService;
            _commodityTypeService = commodityTypeService;
            _commoditySourceService = commoditySourceService;
            _projectCodeService = projectCodeService;
            _shippingInstructionService = shippingInstructionService;
            _receiveService = receiveService;

            _storeService = storeService;
            _hubService = hubService;
            _adminUnitService = adminUnitService;
            _dispatchAllocationService = dispatchAllocationService;
            _donorService = donorService;
        }
 public GiftCertificateController(
     IGiftCertificateService giftCertificateService,
     ICommodityService commodityService,
    IUserProfileService userProfileService,
     IReceiptAllocationService receiptAllocationService,
     IDetailService detailService,
     ICommodityTypeService commodityTypeService,
    IDonorService donorService,
     IProgramService programService,
     IGiftCertificateDetailService giftCertificateDetailService, IShippingInstructionService shippingInstructionService)
     : base(userProfileService)
 {
     _giftCertificateService = giftCertificateService;
     _commodityService = commodityService;
     _userProfileService = userProfileService;
     _receiptAllocationService = receiptAllocationService;
     _detailService = detailService;
     _commodityTypeService = commodityTypeService;
     _donorService = donorService;
     _programService = programService;
     _giftCertificateDetailService = giftCertificateDetailService;
     _shippingInstructionService = shippingInstructionService;
 }
 public ReceiptAllocationController(IReceiptAllocationService receiptAllocationService,
                                    IUserProfileService userProfileService,
                                    ICommoditySourceService commoditySourceService,
                                    IGiftCertificateService giftCertificateService,
                                    ICommodityService commodityService,
                                    IDonorService donorService,
                                    IGiftCertificateDetailService giftCertificateDetailService,
                                    IHubService hubService,
                                    IProgramService programService,
                                    ICommodityTypeService commodityTypeService, IShippingInstructionService shippingInstructionService) : base(userProfileService)
 {
     this._receiptAllocationService     = receiptAllocationService;
     this._userProfileService           = userProfileService;
     this._commoditySourceService       = commoditySourceService;
     this._giftCertificateService       = giftCertificateService;
     this._commodityService             = commodityService;
     this._donorService                 = donorService;
     this._giftCertificateDetailService = giftCertificateDetailService;
     this._hubService            = hubService;
     this._programService        = programService;
     this._commodityTypeService  = commodityTypeService;
     _shippingInstructionService = shippingInstructionService;
 }
Example #21
0
 public GiftCertificateController(
     IGiftCertificateService giftCertificateService,
     ICommodityService commodityService,
     IUserProfileService userProfileService,
     IReceiptAllocationService receiptAllocationService,
     IDetailService detailService,
     ICommodityTypeService commodityTypeService,
     IDonorService donorService,
     IProgramService programService,
     IGiftCertificateDetailService giftCertificateDetailService, IShippingInstructionService shippingInstructionService)
     : base(userProfileService)
 {
     _giftCertificateService          = giftCertificateService;
     _commodityService                = commodityService;
     _userProfileService              = userProfileService;
     _receiptAllocationService        = receiptAllocationService;
     _detailService                   = detailService;
     _commodityTypeService            = commodityTypeService;
     _donorService                    = donorService;
     _programService                  = programService;
     _giftCertificateDetailService    = giftCertificateDetailService;
     this._shippingInstructionService = shippingInstructionService;
 }
 public ReceiptAllocationController(IReceiptAllocationService receiptAllocationService,
     IUserProfileService userProfileService,
     ICommoditySourceService commoditySourceService,
     IGiftCertificateService giftCertificateService,
     ICommodityService commodityService,
     IDonorService donorService,
     IGiftCertificateDetailService giftCertificateDetailService,
     IHubService hubService,
     IProgramService programService,
     ICommodityTypeService commodityTypeService, IShippingInstructionService shippingInstructionService)
     : base(userProfileService)
 {
     this._receiptAllocationService = receiptAllocationService;
     this._userProfileService = userProfileService;
     this._commoditySourceService = commoditySourceService;
     this._giftCertificateService = giftCertificateService;
     this._commodityService = commodityService;
     this._donorService = donorService;
     this._giftCertificateDetailService = giftCertificateDetailService;
     this._hubService = hubService;
     this._programService = programService;
     this._commodityTypeService = commodityTypeService;
     this._shippingInstructionService = shippingInstructionService;
 }
 public OtherDispatchAllocationService(IUnitOfWork unitOfWork, IProjectCodeService projectCodeService, IShippingInstructionService ShippingInstructionService)
 {
     this._unitOfWork = unitOfWork;
     this._projectCodeService=projectCodeService;
     this._shippingInstructionService = ShippingInstructionService;
 }
 public DispatchAllocationService(IUnitOfWork unitOfWork, IShippingInstructionService shippingInstructionService)
 {
     this._unitOfWork = unitOfWork;
     this._shippingInstructionService = shippingInstructionService;
 }
Example #25
0
        public void Init()
        {
            var unitOfWork = new Mock <IUnitOfWork>();
            var receive    = new List <Receive>()
            {
                new Receive()
                {
                    ReceiveID                = Guid.NewGuid(),
                    PartitionId              = 0,
                    GRN                      = "001",
                    CommodityTypeID          = 1,
                    SourceDonorID            = 1,
                    ResponsibleDonorID       = 1,
                    TransporterID            = 1,
                    PlateNo_Prime            = "00001",
                    PlateNo_Trailer          = "00002",
                    DriverName               = "Dawit",
                    WeightBridgeTicketNumber = "012",
                    WeightBeforeUnloading    = 1200,
                    WeightAfterUnloading     = 0,
                    ReceiptDate              = DateTime.Today,
                    UserProfileID            = 1,
                    CreatedDate              = DateTime.Today,
                    WayBillNo                = "001",
                    CommoditySourceID        = 1,
                    Remark                   = "this a a test receive",
                    VesselName               = "002",
                    ReceivedByStoreMan       = "Abebe",
                    PortName                 = "Dire Dawa",
                    PurchaseOrder            = "002",
                    SupplierName             = "WFP",
                    ReceiptAllocationID      = Guid.NewGuid(),
                    CommoditySource          = new CommoditySource()
                    {
                        CommoditySourceID = 1,
                        Name = "Donatiion"
                    },
                    CommodityType = new CommodityType()
                    {
                        CommodityTypeID = 1,
                        Name            = "FOOD"
                    },
                    Hub = new Models.Hubs.Hub()
                    {
                        HubID = 1,
                        Name  = "Kombelcha"
                    },
                    ReceiveDetails = new Collection <ReceiveDetail>()
                    {
                        new ReceiveDetail()
                        {
                            ReceiveDetailID = Guid.NewGuid(),
                            PartitionId     = 0,
                            ReceiveID       = Guid.NewGuid(),
                            //should be given the
                            TransactionGroupID = null,
                            CommodityID        = 1,
                            SentQuantityInUnit = 1200,
                            UnitID             = 1,
                            SentQuantityInMT   = 1200,
                            Description        = "this is a test",
                            Commodity          = new Commodity()
                            {
                                CommodityID = 1,
                                Name        = "Pulse"
                            },
                            Unit = new Unit()
                            {
                                UnitID = 1,
                                Name   = "kg"
                            }
                        }
                    }
                }
            };

            var reieveRepository = new Mock <IGenericRepository <Receive> >();

            reieveRepository.Setup(
                t =>
                t.Get(It.IsAny <Expression <Func <Receive, bool> > >(),
                      It.IsAny <Func <IQueryable <Receive>, IOrderedQueryable <Receive> > >(),
                      It.IsAny <string>())).Returns(receive);
            var commodity = new List <Commodity>()
            {
                new Commodity()
                {
                    CommodityID = 1,
                    Name        = "Pulse"
                },
                new Commodity()
                {
                    CommodityID = 2,
                    Name        = "Cereal"
                }
            };
            var CommodityRepository = new Mock <IGenericRepository <Commodity> >();

            CommodityRepository.Setup(t => t.FindById(It.IsAny <int>())).Returns(
                (int id) => commodity.FirstOrDefault(t => t.CommodityID == id));

            var commodityType = new List <CommodityType>()
            {
                new CommodityType()
                {
                    CommodityTypeID = 1,
                    Name            = "Food"
                },
                new CommodityType()
                {
                    CommodityTypeID = 2,
                    Name            = "Non-Food"
                }
            };

            var commodityTypeRepository = new  Mock <IGenericRepository <CommodityType> >();

            commodityTypeRepository.Setup(t => t.FindById(It.IsAny <int>())).Returns((int id) => commodityType.
                                                                                     FirstOrDefault(t => t.CommodityTypeID == id));

            commodityTypeRepository.Setup(t =>
                                          t.Get(It.IsAny <Expression <Func <CommodityType, bool> > >(),
                                                It.IsAny <Func <IQueryable <CommodityType>, IOrderedQueryable <CommodityType> > >(),
                                                It.IsAny <string>())).Returns(commodityType);



            var shippingInstructioncodes = new List <ShippingInstruction>()
            {
                new ShippingInstruction()
                {
                    ShippingInstructionID = 1,
                    Value = "si-0002",
                },
                new ShippingInstruction()
                {
                    ShippingInstructionID = 2,
                    Value = "si-003",
                }
            };

            Mock <IShippingInstructionService> MockShippingInstructionService = new Mock <IShippingInstructionService>();

            MockShippingInstructionService.Setup(s => s.GetSINumberIdWithCreate("si-0002")).Returns(shippingInstructioncodes.FirstOrDefault());

            var shippingInstructionRepository = new Mock <IGenericRepository <ShippingInstruction> >();

            shippingInstructionRepository.Setup(
                t =>
                t.Get(It.IsAny <Expression <Func <ShippingInstruction, bool> > >(),
                      It.IsAny <Func <IQueryable <ShippingInstruction>, IOrderedQueryable <ShippingInstruction> > >(),
                      It.IsAny <string>())).Returns(shippingInstructioncodes);



            var account = new List <Account>()
            {
                new Account()
                {
                    AccountID  = 1,
                    EntityID   = 1,
                    EntityType = "Sample Entity"
                }
            };

            var accountRepository  = new Mock <IGenericRepository <Account> >();
            var MockAccountService = new Mock <IAccountService>();

            MockAccountService.Setup(a => a.GetAccountIdWithCreate("Sample Entity", 1)).Returns(1);

            var projectCodes = new List <ProjectCode>()
            {
                new ProjectCode()
                {
                    ProjectCodeID = 1,
                    Value         = "pro-001"
                },
                new ProjectCode()
                {
                    ProjectCodeID = 1,
                    Value         = "0001246"
                },
            };

            var MockProjectCodeService = new Mock <IProjectCodeService>();

            MockProjectCodeService.Setup(p => p.GetProjectCodeIdWIthCreate("pro-001")).Returns(projectCodes.FirstOrDefault());

            var projectCodeRepositoy = new Mock <IGenericRepository <ProjectCode> >();

            projectCodeRepositoy.Setup(
                t =>
                t.Get(It.IsAny <Expression <Func <ProjectCode, bool> > >(),
                      It.IsAny <Func <IQueryable <ProjectCode>, IOrderedQueryable <ProjectCode> > >(),
                      It.IsAny <string>())).Returns(projectCodes);


            shippingInstructionService = MockShippingInstructionService.Object;
            unitOfWork.Setup(t => t.ReceiveRepository).Returns(reieveRepository.Object);
            unitOfWork.Setup(t => t.CommodityTypeRepository).Returns(commodityTypeRepository.Object);
            unitOfWork.Setup(t => t.CommodityRepository).Returns(CommodityRepository.Object);
            _accountTransactionService = new TransactionService(unitOfWork.Object, MockAccountService.Object, shippingInstructionService, MockProjectCodeService.Object);
        }
Example #26
0
 public ReceiptAllocationService(IUnitOfWork unitOfWork, IShippingInstructionService ShippingInstructionService, IDispatchAllocationService DispatchAllocationService)
 {
     this._unitOfWork = unitOfWork;
     this._ShippingInstructionService = ShippingInstructionService;
     this._DispatchAllocationService = DispatchAllocationService;
 }
 public DispatchAllocationService(IUnitOfWork unitOfWork, IShippingInstructionService shippingInstructionService)
 {
     this._unitOfWork = unitOfWork;
     this._shippingInstructionService = shippingInstructionService;
 }
 public OtherDispatchAllocationService(IUnitOfWork unitOfWork, IProjectCodeService projectCodeService, IShippingInstructionService ShippingInstructionService)
 {
     this._unitOfWork                 = unitOfWork;
     this._projectCodeService         = projectCodeService;
     this._shippingInstructionService = ShippingInstructionService;
 }
        public void Init()
        {
            var unitOfWork = new Mock<IUnitOfWork>();
            var receive = new List<Receive>()
                              {
                                  new Receive()
                                      {
                                          ReceiveID = Guid.NewGuid(),
                                          PartitionID = 0,
                                          GRN = "001",
                                          CommodityTypeID = 1,
                                          SourceDonorID = 1,
                                          ResponsibleDonorID = 1,
                                          TransporterID = 1,
                                          PlateNo_Prime = "00001",
                                          PlateNo_Trailer = "00002",
                                          DriverName = "Dawit",
                                          WeightBridgeTicketNumber = "012",
                                          WeightBeforeUnloading = 1200,
                                          WeightAfterUnloading = 0,
                                          ReceiptDate = DateTime.Today,
                                          UserProfileID = 1,
                                          CreatedDate = DateTime.Today,
                                          WayBillNo = "001",
                                          CommoditySourceID = 1,
                                          Remark = "this a a test receive",
                                          VesselName = "002",
                                          ReceivedByStoreMan = "Abebe",
                                          PortName = "Dire Dawa",
                                          PurchaseOrder = "002",
                                          SupplierName = "WFP",
                                          ReceiptAllocationID = Guid.NewGuid(),
                                          CommoditySource = new CommoditySource()
                                                                {
                                                                    CommoditySourceID = 1,
                                                                    Name = "Donatiion"

                                                                },
                                          CommodityType = new CommodityType()
                                                              {
                                                                  CommodityTypeID = 1,
                                                                  Name = "FOOD"
                                                              },
                                          Hub = new Models.Hubs.Hub()
                                                    {
                                                        HubID = 1,
                                                        Name = "Kombelcha"
                                                    },
                                          ReceiveDetails = new Collection<ReceiveDetail>()
                                                               {
                                                                   new ReceiveDetail()
                                                                       {
                                                                           ReceiveDetailID = Guid.NewGuid(),
                                                                           PartitionID = 0,
                                                                           ReceiveID = Guid.NewGuid(),
                                                                           //should be given the
                                                                           TransactionGroupID = null,
                                                                           CommodityID = 1,
                                                                           SentQuantityInUnit = 1200,
                                                                           UnitID = 1,
                                                                           SentQuantityInMT = 1200,
                                                                           Description = "this is a test",
                                                                           Commodity = new Commodity()
                                                                                           {
                                                                                               CommodityID = 1,
                                                                                               Name = "Pulse"
                                                                                           },
                                                                           Unit = new Unit()
                                                                                      {
                                                                                          UnitID = 1,
                                                                                          Name = "kg"
                                                                                      }

                                                                       }
                                                               }

                                      }

                              };

            var reieveRepository = new Mock<IGenericRepository<Receive>>();
            reieveRepository.Setup(
                t =>
                t.Get(It.IsAny<Expression<Func<Receive, bool>>>(),
                      It.IsAny<Func<IQueryable<Receive>, IOrderedQueryable<Receive>>>(),
                      It.IsAny<string>())).Returns(receive);
            var commodity = new List<Commodity>()
                                {
                                    new Commodity()
                                        {
                                            CommodityID = 1,
                                            Name = "Pulse"
                                        },
                                    new Commodity()
                                        {
                                            CommodityID = 2,
                                            Name = "Cereal"
                                        }
                                };
            var CommodityRepository = new Mock<IGenericRepository<Commodity>>();
            CommodityRepository.Setup(t => t.FindById(It.IsAny<int>())).Returns(
                (int id) => commodity.FirstOrDefault(t => t.CommodityID == id));

            var commodityType = new List<CommodityType>()
                                    {
                                        new CommodityType()
                                            {

                                                CommodityTypeID = 1,
                                                Name = "Food"
                                            },
                                            new CommodityType()
                                                {
                                                    CommodityTypeID = 2,
                                                    Name = "Non-Food"
                                                }
                                    };

            var commodityTypeRepository =new  Mock<IGenericRepository<CommodityType>>();
            commodityTypeRepository.Setup(t => t.FindById(It.IsAny<int>())).Returns((int id) => commodityType.
                                                                                                 FirstOrDefault(t => t.CommodityTypeID == id));

            commodityTypeRepository.Setup(t =>
                t.Get(It.IsAny<Expression<Func<CommodityType, bool>>>(),
                      It.IsAny<Func<IQueryable<CommodityType>, IOrderedQueryable<CommodityType>>>(),
                      It.IsAny<string>())).Returns(commodityType);

            var shippingInstructioncodes = new List<ShippingInstruction>()
                                               {
                                                   new ShippingInstruction()
                                                       {
                                                           ShippingInstructionID = 1,
                                                           Value = "si-0002",
                                                       },
                                                   new ShippingInstruction()
                                                       {
                                                           ShippingInstructionID = 2,
                                                           Value = "si-003",
                                                       }
                                               };

            Mock<IShippingInstructionService> MockShippingInstructionService = new Mock<IShippingInstructionService>();
            MockShippingInstructionService.Setup(s => s.GetSINumberIdWithCreate("si-0002")).Returns(shippingInstructioncodes.FirstOrDefault());

            var shippingInstructionRepository = new Mock<IGenericRepository<ShippingInstruction>>();

            shippingInstructionRepository.Setup(
                t =>
                t.Get(It.IsAny<Expression<Func<ShippingInstruction, bool>>>(),
                      It.IsAny<Func<IQueryable<ShippingInstruction>, IOrderedQueryable<ShippingInstruction>>>(),
                      It.IsAny<string>())).Returns(shippingInstructioncodes);

            var account = new List<Account>()
                              {
                                  new Account()
                                      {
                                          AccountID = 1,
                                          EntityID = 1,
                                          EntityType = "Sample Entity"
                                      }
                              };

            var accountRepository = new Mock<IGenericRepository<Account>>();
            var MockAccountService = new Mock<IAccountService>();
            MockAccountService.Setup(a => a.GetAccountIdWithCreate("Sample Entity", 1)).Returns(1);

             var projectCodes = new List<ProjectCode>()
                                   {
                                       new ProjectCode()
                                           {
                                               ProjectCodeID = 1,
                                               Value = "pro-001"
                                           },
                                       new ProjectCode()
                                           {
                                               ProjectCodeID = 1,
                                               Value = "0001246"
                                           },
                                   };

            var MockProjectCodeService = new Mock<IProjectCodeService>();
            MockProjectCodeService.Setup(p => p.GetProjectCodeIdWIthCreate("pro-001")).Returns(projectCodes.FirstOrDefault());

            var projectCodeRepositoy = new Mock<IGenericRepository<ProjectCode>>();
            projectCodeRepositoy.Setup(
                t =>
                t.Get(It.IsAny<Expression<Func<ProjectCode, bool>>>(),
                      It.IsAny<Func<IQueryable<ProjectCode>, IOrderedQueryable<ProjectCode>>>(),
                      It.IsAny<string>())).Returns(projectCodes);

            shippingInstructionService = MockShippingInstructionService.Object;
            unitOfWork.Setup(t => t.ReceiveRepository).Returns(reieveRepository.Object);
            unitOfWork.Setup(t => t.CommodityTypeRepository).Returns(commodityTypeRepository.Object);
            unitOfWork.Setup(t => t.CommodityRepository).Returns(CommodityRepository.Object);
            _accountTransactionService = new TransactionService(unitOfWork.Object, MockAccountService.Object, shippingInstructionService, MockProjectCodeService.Object);
        }
Example #30
0
 public ReceiptAllocationService(IUnitOfWork unitOfWork, IShippingInstructionService ShippingInstructionService, IDispatchAllocationService DispatchAllocationService)
 {
     this._unitOfWork = unitOfWork;
     this._ShippingInstructionService = ShippingInstructionService;
     this._DispatchAllocationService  = DispatchAllocationService;
 }