コード例 #1
0
 public XmlImportModule(ILogger <XmlImportModule> logger, IMapper mapper, ICustomerDataAccess customerDataAccess, IProductDataAccess productDataAccess)
 {
     this.logger             = logger ?? throw new ArgumentNullException(nameof(logger));
     this.mapper             = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.customerDataAccess = customerDataAccess ?? throw new ArgumentNullException(nameof(customerDataAccess));
     this.productDataAccess  = productDataAccess ?? throw new ArgumentNullException(nameof(productDataAccess));
 }
コード例 #2
0
ファイル: ProductService.cs プロジェクト: jbardon/learndotnet
 public ProductService(
     // Old way: WithKey attribute
     [KeyFilter("ProductBusinessChecks")] IBusinessCheck <ProductBusinessCheckContext> businessChecks,
     IProductDataAccess dataAccess)
 {
     _businessChecks = businessChecks;
     _dataAccess     = dataAccess;
 }
コード例 #3
0
        public void ExpectToCallGetAllProductsOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);

            view.ViewLoad += Raise.EventWith(view, new EventArgs());
            dataAccess.Received().GetAllProducts();
        }
コード例 #4
0
        public FindProduct()
        {
            _productDataAccess = new ProductDataAccess();

            InitializeComponent();

            var products = _productDataAccess.GetWithStock();

            DrawProductItems(products);
        }
コード例 #5
0
        public void ExpectToCallDeleteProductOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);



            view.DeleteProduct += Raise.Event <EventHandler <int> >(view, 2);

            dataAccess.Received().DeleteProduct(2);
        }
コード例 #6
0
        public void ExpectToCallEditProductOnAppropriateEventReceived()
        {
            IProductView       view       = Substitute.For <IProductView>();
            IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>();
            ProductPresenter   presenter  = new ProductPresenter(view, dataAccess);

            ProductViewModel viewModel = new ProductViewModel()
            {
                NameText  = "Test",
                PriceText = "2"
            };

            view.ModifyProduct += Raise.Event <EventHandler <ProductViewModel> >(view, viewModel);
            dataAccess.Received().EditProduct(Arg.Any <int>(), Arg.Is <Product>(x => x.Price == 2 && x.Name == "Test"));
        }
コード例 #7
0
 //
 // GET: /AddProduct/
 public AddProductController()
 {
     _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
     _caregoryDataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository());
 }
コード例 #8
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public int GetCampaignServiceCountByName(string searchTerm, int pageSize, int pageNum, int?productGroupId, int?productId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetCampaignServiceCountByName(searchTerm, pageSize, pageNum, productGroupId, productId));
 }
コード例 #9
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public bool DeleteSRStatus(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.DeleteSRStatus(searchFilter));
 }
コード例 #10
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public bool IsDuplicateSRStatus(ProductSREntity product)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.IsDuplicateSRStatus(product));
 }
コード例 #11
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public IEnumerable <ProductSREntity> SearchProducts(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.SearchProducts(searchFilter));
 }
コード例 #12
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public List <DoNotCallActivityProductInput> GetActivityProductIdFromProductCodeList(List <DoNotCallActivityProductInput> productCodes)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetActivityProductIdFromProductCodeList(productCodes));
 }
コード例 #13
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public int GetSubAreaCountByName(string searchTerm, int pageSize, int pageNum, int?areaId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetSubAreaCountByName(searchTerm, pageSize, pageNum, areaId));
 }
コード例 #14
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public int GetTypeCountByName(string searchTerm, int pageSize, int pageNum)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetTypeCountByName(searchTerm, pageSize, pageNum));
 }
コード例 #15
0
 public ProductBusinessModel(IProductDataAccess dataAccess)
 {
     this.DataAccess = dataAccess;
 }
コード例 #16
0
 public OrderDataAccess(IProductDataAccess productDataAccess)
 {
     this.ProductDataAccess = productDataAccess;
 }
コード例 #17
0
		public DefaultProductService(IProductDataAccess productDataAccess)
		{
			this.productDataAccess = productDataAccess;
		}
コード例 #18
0
 public ShowProductsController()
 {
     _dataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
 }
コード例 #19
0
 public ProductService(IProductDataAccess productDataAccess,CloudFarmDbContext cloudFarmDb)
 {
     this.productDataAccess = productDataAccess;
     this.cloudFarmDb = cloudFarmDb;
 }
コード例 #20
0
 public ProductBusinessLogic(IDataAccessFactory dataAccessFactory)
 {
     _dataAccessFactory = dataAccessFactory;
     _productDataAccess = _dataAccessFactory.GetProductDataAccess();
 }
コード例 #21
0
 public ProductModule(ILogger <ProductModule> logger, IMapper mapper, IProductDataAccess productDataAccess)
 {
     this.logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     this.mapper            = mapper ?? throw new ArgumentNullException(nameof(mapper));
     this.productDataAccess = productDataAccess ?? throw new ArgumentNullException(nameof(productDataAccess));
 }
コード例 #22
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public List <TypeEntity> GetTypeByName(string searchTerm, int pageSize, int pageNum)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetTypeByName(searchTerm, pageSize, pageNum));
 }
コード例 #23
0
 public ProductController(IProductDataAccess ProductDataAccess, IProductBusiness ProductBusiness)
 {
     productDataAccess = ProductDataAccess;
     productBusiness   = ProductBusiness;
 }
コード例 #24
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public List <AreaEntity> GetAreaByName(string searchTerm, int pageSize, int pageNum, int?subAreaId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetAreaByName(searchTerm, pageSize, pageNum, subAreaId));
 }
コード例 #25
0
 public LeftSidebarController()
 {
     _dataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository());
     _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
 }
コード例 #26
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
        public CreateProductMasterResponse CreateProductMaster(CreateProductMasterRequest request)
        {
            var stopwatch = System.Diagnostics.Stopwatch.StartNew();

            Logger.Info(_logMsg.Clear().SetPrefixMsg("Call MasterService.CreateProductMaster").ToInputLogString());
            Logger.Debug("I:--START--:--MasterService.CreateProductMaster--");

            bool valid = false;

            _commonFacade = new CommonFacade();
            CreateProductMasterResponse response = new CreateProductMasterResponse();

            if (request.Header != null)
            {
                valid           = _commonFacade.VerifyServiceRequest <Header>(request.Header);
                response.Header = new Header
                {
                    reference_no     = request.Header.reference_no,
                    service_name     = request.Header.service_name,
                    system_code      = request.Header.system_code,
                    transaction_date = request.Header.transaction_date
                };
            }

            Logger.DebugFormat("-- XMLRequest --\n{0}", request.SerializeObject());

            var auditLog = new AuditLogEntity();

            auditLog.Module    = Constants.Module.Customer;
            auditLog.Action    = Constants.AuditAction.CreateProductMaster;
            auditLog.IpAddress = ApplicationHelpers.GetClientIP();

            #region "Call Validator"

            if (!valid)
            {
                response.StatusResponse = new StatusResponse
                {
                    ErrorCode   = Constants.ErrorCode.CSMProd001,
                    Status      = Constants.StatusResponse.Failed,
                    Description = "Bad Request, the header is not valid"
                };

                AppLog.AuditLog(auditLog, LogStatus.Fail, response.StatusResponse.Description);
                Logger.DebugFormat("-- XMLResponse --\n{0}", response.SerializeObject());

                stopwatch.Stop();
                Logger.DebugFormat("O:--Finish--:ElapsedMilliseconds/{0}", stopwatch.ElapsedMilliseconds);

                return(response);
            }
            else
            {
                dynamic[] results = DoValidation(request);
                valid = (bool)results[0];
                List <ValidationResult> validationResults = (List <ValidationResult>)results[1];

                if (!valid)
                {
                    response.StatusResponse           = new StatusResponse();
                    response.StatusResponse.ErrorCode = Constants.ErrorCode.CSMProd002;
                    response.StatusResponse.Status    = Constants.StatusResponse.Failed;

                    if (validationResults != null && validationResults.Count > 0)
                    {
                        string msg = "Bad Request, the body is not valid:\n{0}";
                        response.StatusResponse.Description = string.Format(CultureInfo.InvariantCulture, msg,
                                                                            validationResults.Select(x => x.ErrorMessage).Aggregate((i, j) => i + Delimeter + j));
                    }

                    AppLog.AuditLog(auditLog, LogStatus.Fail, response.StatusResponse.Description);
                    Logger.DebugFormat("-- XMLResponse --\n{0}", response.SerializeObject());

                    stopwatch.Stop();
                    Logger.DebugFormat("O:--Finish--:ElapsedMilliseconds/{0}", stopwatch.ElapsedMilliseconds);

                    return(response);
                }
            }

            #endregion

            ProductEntity         product      = null;
            CampaignServiceEntity campaign     = null;
            ProductGroupEntity    productGroup = null;

            if (!string.IsNullOrWhiteSpace(request.ProductGroup.Code) &&
                !string.IsNullOrWhiteSpace(request.ProductGroup.Name))
            {
                productGroup = new ProductGroupEntity
                {
                    ProductGroupCode = request.ProductGroup.Code,
                    ProductGroupName = request.ProductGroup.Name,
                    IsActive         = Constants.ApplicationStatus.Active.ConvertToString().Equals(request.ProductGroup.Status) ? true : false,
                    CreateUser       = request.ProductGroup.CreateUser,
                    CreateDate       = request.ProductGroup.CreateDateValue,
                    UpdateUser       = request.ProductGroup.UpdateUser,
                    UpdateDate       = request.ProductGroup.UpdateDateValue
                };
            }

            if (request.Product != null && !string.IsNullOrWhiteSpace(request.Product.Code) &&
                !string.IsNullOrWhiteSpace(request.Product.Name))
            {
                product = new ProductEntity
                {
                    ProductCode = request.Product.Code,
                    ProductName = request.Product.Name,
                    ProductType = request.Product.ProductType,
                    IsActive    = Constants.ApplicationStatus.Active.ConvertToString().Equals(request.Product.Status) ? true : false,
                    CreateUser  = request.Product.CreateUser,
                    CreateDate  = request.Product.CreateDateValue,
                    UpdateUser  = request.Product.UpdateUser,
                    UpdateDate  = request.Product.UpdateDateValue
                };
            }

            if (request.Campaign != null && !string.IsNullOrWhiteSpace(request.Campaign.Code) &&
                !string.IsNullOrWhiteSpace(request.Campaign.Name))
            {
                campaign = new CampaignServiceEntity
                {
                    CampaignServiceCode = request.Campaign.Code,
                    CampaignServiceName = request.Campaign.Name,
                    IsActive            = Constants.ApplicationStatus.Active.ConvertToString().Equals(request.Campaign.Status) ? true : false,
                    CreateUser          = request.Campaign.CreateUser,
                    CreateDate          = request.Campaign.CreateDateValue,
                    UpdateUser          = request.Campaign.UpdateUser,
                    UpdateDate          = request.Campaign.UpdateDateValue
                };
            }

            if (productGroup != null)
            {
                _productDataAccess = new ProductDataAccess(_context);
                bool success = _productDataAccess.SaveProductMaster(productGroup, product, campaign);

                if (success)
                {
                    response.StatusResponse = new StatusResponse
                    {
                        ErrorCode   = string.Empty,
                        Status      = Constants.StatusResponse.Success,
                        Description = "Create successful data"
                    };

                    AppLog.AuditLog(auditLog, LogStatus.Success, response.StatusResponse.Description);

                    Logger.DebugFormat("-- XMLResponse --\n{0}", response.SerializeObject());
                    stopwatch.Stop();
                    Logger.DebugFormat("O:--Finish--:ElapsedMilliseconds/{0}", stopwatch.ElapsedMilliseconds);

                    return(response);
                }
            }

            response.StatusResponse = new StatusResponse
            {
                ErrorCode   = Constants.ErrorCode.CSMProd003,
                Status      = Constants.StatusResponse.Failed,
                Description = "Fail to create data"
            };

            AppLog.AuditLog(auditLog, LogStatus.Fail, response.StatusResponse.Description);
            Logger.DebugFormat("-- XMLResponse --\n{0}", response.SerializeObject());
            stopwatch.Stop();
            Logger.DebugFormat("O:--Finish--:ElapsedMilliseconds/{0}", stopwatch.ElapsedMilliseconds);

            return(response);
        }
コード例 #27
0
 public ProductService(IProductDataAccess data)
 {
     this.data = data;
 }
コード例 #28
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public List <ProductEntity> GetProductList(int?productGroupId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProductList(productGroupId));
 }
コード例 #29
0
 public OrderDataAccess(IProductDataAccess productDataAccess)
 {
     this.ProductDataAccess = productDataAccess;
 }
コード例 #30
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public ProductSREntity GetProduct(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProduct(searchFilter));
 }
コード例 #31
0
 /// <summary>
 /// </summary>
 /// <param name="dataAccess"></param>
 public ProductController(IProductDataAccess dataAccess)
 {
     _dataAccess = dataAccess;
 }
コード例 #32
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public bool SaveSRStatus(ProductSREntity productEntity)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.SaveSRStatus(productEntity));
 }
コード例 #33
0
 public List <ProductEntity> GetProductList()
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProductList());
 }
コード例 #34
0
ファイル: ProductFacade.cs プロジェクト: KKPBank/DNC
 public List <ProductEntity> GetProductByName(string searchTerm, int pageSize, int pageNum, int?productGroupId, int?campaignId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProductByName(searchTerm, pageSize, pageNum, productGroupId, campaignId));
 }
コード例 #35
0
 public ProductBusinessLogic(IProductDataAccess dataAccess)
 {
     _dataAccess = dataAccess;
     ConfigAutoMapper();
 }
コード例 #36
0
 public ProductService(IProductDataAccess productDataAccess)
 {
     this.productDataAccess = productDataAccess;
 }
コード例 #37
0
		public DefaultRecommendationService(IProductDataAccess productDataAccess)
		{
			this.productDataAccess = productDataAccess;
			this.random = new Random((int) DateTime.Now.Ticks);
		}