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)); }
public ProductService( // Old way: WithKey attribute [KeyFilter("ProductBusinessChecks")] IBusinessCheck <ProductBusinessCheckContext> businessChecks, IProductDataAccess dataAccess) { _businessChecks = businessChecks; _dataAccess = dataAccess; }
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(); }
public FindProduct() { _productDataAccess = new ProductDataAccess(); InitializeComponent(); var products = _productDataAccess.GetWithStock(); DrawProductItems(products); }
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); }
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")); }
// // GET: /AddProduct/ public AddProductController() { _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository()); _caregoryDataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository()); }
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)); }
public bool DeleteSRStatus(ProductSearchFilter searchFilter) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.DeleteSRStatus(searchFilter)); }
public bool IsDuplicateSRStatus(ProductSREntity product) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.IsDuplicateSRStatus(product)); }
public IEnumerable <ProductSREntity> SearchProducts(ProductSearchFilter searchFilter) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.SearchProducts(searchFilter)); }
public List <DoNotCallActivityProductInput> GetActivityProductIdFromProductCodeList(List <DoNotCallActivityProductInput> productCodes) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetActivityProductIdFromProductCodeList(productCodes)); }
public int GetSubAreaCountByName(string searchTerm, int pageSize, int pageNum, int?areaId) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetSubAreaCountByName(searchTerm, pageSize, pageNum, areaId)); }
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; }
public OrderDataAccess(IProductDataAccess productDataAccess) { this.ProductDataAccess = productDataAccess; }
public DefaultProductService(IProductDataAccess productDataAccess) { this.productDataAccess = productDataAccess; }
public ShowProductsController() { _dataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository()); }
public ProductService(IProductDataAccess productDataAccess,CloudFarmDbContext cloudFarmDb) { this.productDataAccess = productDataAccess; this.cloudFarmDb = cloudFarmDb; }
public ProductBusinessLogic(IDataAccessFactory dataAccessFactory) { _dataAccessFactory = dataAccessFactory; _productDataAccess = _dataAccessFactory.GetProductDataAccess(); }
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)); }
public List <TypeEntity> GetTypeByName(string searchTerm, int pageSize, int pageNum) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetTypeByName(searchTerm, pageSize, pageNum)); }
public ProductController(IProductDataAccess ProductDataAccess, IProductBusiness ProductBusiness) { productDataAccess = ProductDataAccess; productBusiness = ProductBusiness; }
public List <AreaEntity> GetAreaByName(string searchTerm, int pageSize, int pageNum, int?subAreaId) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetAreaByName(searchTerm, pageSize, pageNum, subAreaId)); }
public LeftSidebarController() { _dataAccess = new CategoryDataAccess(new DtoMapper(), new CategoryRepository()); _productDataAccess = new ProductDataAccess(new DtoMapper(), new ProductRepository()); }
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); }
public ProductService(IProductDataAccess data) { this.data = data; }
public List <ProductEntity> GetProductList(int?productGroupId) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetProductList(productGroupId)); }
public ProductSREntity GetProduct(ProductSearchFilter searchFilter) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetProduct(searchFilter)); }
/// <summary> /// </summary> /// <param name="dataAccess"></param> public ProductController(IProductDataAccess dataAccess) { _dataAccess = dataAccess; }
public bool SaveSRStatus(ProductSREntity productEntity) { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.SaveSRStatus(productEntity)); }
public List <ProductEntity> GetProductList() { _productDataAccess = new ProductDataAccess(_context); return(_productDataAccess.GetProductList()); }
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(); }
public ProductService(IProductDataAccess productDataAccess) { this.productDataAccess = productDataAccess; }
public DefaultRecommendationService(IProductDataAccess productDataAccess) { this.productDataAccess = productDataAccess; this.random = new Random((int) DateTime.Now.Ticks); }