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));
 }
Exemplo n.º 2
0
 public ProductService(
     // Old way: WithKey attribute
     [KeyFilter("ProductBusinessChecks")] IBusinessCheck <ProductBusinessCheckContext> businessChecks,
     IProductDataAccess dataAccess)
 {
     _businessChecks = businessChecks;
     _dataAccess     = dataAccess;
 }
Exemplo n.º 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();
        }
Exemplo n.º 4
0
        public FindProduct()
        {
            _productDataAccess = new ProductDataAccess();

            InitializeComponent();

            var products = _productDataAccess.GetWithStock();

            DrawProductItems(products);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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"));
        }
Exemplo n.º 7
0
 //
 // GET: /AddProduct/
 public AddProductController()
 {
     _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
     _caregoryDataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository());
 }
Exemplo n.º 8
0
 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));
 }
Exemplo n.º 9
0
 public bool DeleteSRStatus(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.DeleteSRStatus(searchFilter));
 }
Exemplo n.º 10
0
 public bool IsDuplicateSRStatus(ProductSREntity product)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.IsDuplicateSRStatus(product));
 }
Exemplo n.º 11
0
 public IEnumerable <ProductSREntity> SearchProducts(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.SearchProducts(searchFilter));
 }
Exemplo n.º 12
0
 public List <DoNotCallActivityProductInput> GetActivityProductIdFromProductCodeList(List <DoNotCallActivityProductInput> productCodes)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetActivityProductIdFromProductCodeList(productCodes));
 }
Exemplo n.º 13
0
 public int GetSubAreaCountByName(string searchTerm, int pageSize, int pageNum, int?areaId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetSubAreaCountByName(searchTerm, pageSize, pageNum, areaId));
 }
Exemplo n.º 14
0
 public int GetTypeCountByName(string searchTerm, int pageSize, int pageNum)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetTypeCountByName(searchTerm, pageSize, pageNum));
 }
 public ProductBusinessModel(IProductDataAccess dataAccess)
 {
     this.DataAccess = dataAccess;
 }
Exemplo n.º 16
0
 public OrderDataAccess(IProductDataAccess productDataAccess)
 {
     this.ProductDataAccess = productDataAccess;
 }
Exemplo n.º 17
0
		public DefaultProductService(IProductDataAccess productDataAccess)
		{
			this.productDataAccess = productDataAccess;
		}
Exemplo n.º 18
0
 public ShowProductsController()
 {
     _dataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
 }
Exemplo n.º 19
0
 public ProductService(IProductDataAccess productDataAccess,CloudFarmDbContext cloudFarmDb)
 {
     this.productDataAccess = productDataAccess;
     this.cloudFarmDb = cloudFarmDb;
 }
Exemplo n.º 20
0
 public ProductBusinessLogic(IDataAccessFactory dataAccessFactory)
 {
     _dataAccessFactory = dataAccessFactory;
     _productDataAccess = _dataAccessFactory.GetProductDataAccess();
 }
Exemplo n.º 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));
 }
Exemplo n.º 22
0
 public List <TypeEntity> GetTypeByName(string searchTerm, int pageSize, int pageNum)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetTypeByName(searchTerm, pageSize, pageNum));
 }
Exemplo n.º 23
0
 public ProductController(IProductDataAccess ProductDataAccess, IProductBusiness ProductBusiness)
 {
     productDataAccess = ProductDataAccess;
     productBusiness   = ProductBusiness;
 }
Exemplo n.º 24
0
 public List <AreaEntity> GetAreaByName(string searchTerm, int pageSize, int pageNum, int?subAreaId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetAreaByName(searchTerm, pageSize, pageNum, subAreaId));
 }
Exemplo n.º 25
0
 public LeftSidebarController()
 {
     _dataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository());
     _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository());
 }
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
 public ProductService(IProductDataAccess data)
 {
     this.data = data;
 }
Exemplo n.º 28
0
 public List <ProductEntity> GetProductList(int?productGroupId)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProductList(productGroupId));
 }
Exemplo n.º 29
0
 public OrderDataAccess(IProductDataAccess productDataAccess)
 {
     this.ProductDataAccess = productDataAccess;
 }
Exemplo n.º 30
0
 public ProductSREntity GetProduct(ProductSearchFilter searchFilter)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProduct(searchFilter));
 }
Exemplo n.º 31
0
 /// <summary>
 /// </summary>
 /// <param name="dataAccess"></param>
 public ProductController(IProductDataAccess dataAccess)
 {
     _dataAccess = dataAccess;
 }
Exemplo n.º 32
0
 public bool SaveSRStatus(ProductSREntity productEntity)
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.SaveSRStatus(productEntity));
 }
Exemplo n.º 33
0
 public List <ProductEntity> GetProductList()
 {
     _productDataAccess = new ProductDataAccess(_context);
     return(_productDataAccess.GetProductList());
 }
Exemplo n.º 34
0
 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));
 }
 public ProductBusinessLogic(IProductDataAccess dataAccess)
 {
     _dataAccess = dataAccess;
     ConfigAutoMapper();
 }
Exemplo n.º 36
0
 public ProductService(IProductDataAccess productDataAccess)
 {
     this.productDataAccess = productDataAccess;
 }
		public DefaultRecommendationService(IProductDataAccess productDataAccess)
		{
			this.productDataAccess = productDataAccess;
			this.random = new Random((int) DateTime.Now.Ticks);
		}