Example #1
0
        public void Init()
        {
            _goodRepositoryMock = new Mock <IRepository <GoodEntity> >();
            _mapperMock         = new Mock <IMapper>();

            _goodService = new GoodService(_goodRepositoryMock.Object, _mapperMock.Object);
        }
Example #2
0
        public void Cleanup()
        {
            _goodRepositoryMock = null;
            _mapperMock         = null;

            _goodService = null;
        }
 public MainWindow(IGoodService goodService)
 {
     InitializeComponent();
     //this.goodService = goodService;
     //goods = goodService.GetGoods();
     //this.DataContext = goods;
 }
 public GoodsController(IGoodService goodService, ICookieConsumer storage, IRecentlyViewedProvider viewedProvider)
     : base(storage)
 {
     _viewedProvider = viewedProvider;
     _goodService = goodService;
     _sizeStorageViewed = 20;
 }
Example #5
0
 public CatalogController(IGoodService goodService, ICategoryService categoryService, ICookieConsumer storage)
     : base(storage)
 {
     _goodService       = goodService;
     _categoryService   = categoryService;
     _sizeStorageViewed = 5;
 }
Example #6
0
 public GoodController(IHttpContextAccessor httpContextAccessor,
                       IConfiguration configuration,
                       IWebHostEnvironment webHostEnvironment,
                       IGoodService goodService) : base(httpContextAccessor, configuration)
 {
     _webHostEnvironment = webHostEnvironment;
     _goodService        = goodService;
 }
Example #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GoodsController"/> class.
 /// </summary>
 /// <param name="goodService">
 ///     Service that manages goods.
 /// </param>
 /// <param name="addGoodsService">
 ///     Service that adds or updates goods.
 /// </param>
 /// <param name="pageCategoryModelValidator">
 ///     Validator for <see cref="PageCategoryModel"/> instances.
 /// </param>
 public GoodsController(
     IGoodService goodService,
     IAddGoodsService addGoodsService,
     IValidator <PageCategoryModel> pageCategoryModelValidator)
 {
     this._goodService                = goodService;
     this._addGoodsService            = addGoodsService;
     this._pageCategoryModelValidator = pageCategoryModelValidator;
 }
Example #8
0
        public GoodsModifyViewModel(IGoodService goodService)
        {
            this.goodService = goodService;
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Goods, GoodDTO>();
            });

            mapper = config.CreateMapper();
        }
Example #9
0
 public GoodsController(IGoodService service, IRequestDocReader docReader, ICRUDService crudservice) : base(crudservice)
 {
     _service            = service;
     _crudService        = crudservice;
     _docReader          = docReader;
     Searchfields        = new[] { new CrudSearchFieldType("Name", CrudSearchFieldType.Method.Contains) };
     Searchchildincludes = new[] { "ServiceDivision", "ServiceType", "UnitType" };
     Getbyincludes       = new[] { "ServiceDivision", "ServiceType", "UnitType" };
     Orderby             = "Name";
 }
Example #10
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AddGoodsService"/> class.
 /// </summary>
 /// <param name="goodService">
 ///     Instance of type that implements interface
 ///     <see cref="IGoodService"/>.
 /// </param>
 /// <param name="categoryService">
 ///     Instance of type that implements interface
 ///     <see cref="ICategoryService"/>.
 /// </param>
 /// <param name="amazonAdapter">
 ///     Resolver for platform's adapter.
 /// </param>
 /// <param name="requestParametersModelValidator">
 ///     Validator for instance of <see cref="RequestParametersModel"/>.
 /// </param>
 public AddGoodsService(
     IGoodService goodService,
     ICategoryService categoryService,
     IStoreAdapter <AmazonAdapter> amazonAdapter,
     IValidator <RequestParametersModel> requestParametersModelValidator)
 {
     this._goodService     = goodService;
     this._categoryService = categoryService;
     this._amazonAdapter   = amazonAdapter;
     this._requestParametersModelValidator = requestParametersModelValidator;
 }
        public GoodsListViewModel(IGoodService goodService, ICategoryService categoryService)
        {
            this.goodService     = goodService;
            this.categoryService = categoryService;
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Goods, GoodDTO>();
            });

            mapper = config.CreateMapper();

            Update();
        }
Example #12
0
        public Form3(ICategoryService categoryService, IGoodService goodService, ICartGoodService cartgoodService, IUnitOfWork unitOfWork)
        {
            InitializeComponent();
            container            = Boostraper.Init();
            this.categoryService = categoryService;
            this.goodService     = goodService;
            this.cartgoodService = cartgoodService;
            this.unitOfWork      = unitOfWork;

            List <CategoryDTO> categories = categoryService.GetAllCategories();

            comboBox1.DataSource            = categories;
            comboBox1.DisplayMember         = "Name";
            comboBox1.ValueMember           = "Id";
            comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;

            //List<GoodDTO> goods = goodService.GetGoods();
            //comboBox2.DataSource = goods;
            //comboBox2.DisplayMember = "Name";
            //comboBox2.ValueMember = "Id";
            //comboBox2.SelectedIndexChanged += comboBox2_SelectedIndexChanged;
        }
Example #13
0
 public DefaultController(IGoodService goodService)
 {
     this.goodService = goodService;
 }
 public HomeController(IGoodService s)
 {
     service = s;
 }
Example #15
0
 public GoodController(IGoodService goodService)
 {
     service = goodService;
 }
 public GoodsController(IGoodService service)
 {
     _service = service;
 }
Example #17
0
        static void Main(string[] args)
        {
            StandardKernel ninject = new StandardKernel(new BLL.Infrastructure.ServiceModule("StoreConnection"));

            ISupplierService supplier = ninject.Get <ISupplierService>();
            IGoodService     good     = ninject.Get <IGoodService>();
            ICategoryService category = ninject.Get <ICategoryService>();


            //#region First point "Get the list of goods of defined Category"

            //Console.WriteLine("First point \"Get the list of goods of defined Category\"\n");

            //Console.WriteLine("1.1		Get All Goods\n");
            //var goodsFromCategories = category.GetAll();
            //foreach (var categories in goodsFromCategories)
            //{
            //	foreach (var item in categories.Goods)
            //	{
            //		Console.WriteLine(
            //			$"{item.Category.CategoryID}-{item.Category.Name}-{item.Brand}-{item.Model}");
            //	}
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("1.2		Get goods by Id of Category\n");

            //var goodFromCategory = category.GetById(2);//Clothes
            //foreach (var item in goodFromCategory.Goods)
            //{
            //	Console.WriteLine($"{item.Brand}-{item.Model}");
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("1.3		Get goods by name of Category\n");
            //var goodsFromCategory = good.GetGoodsFromCategory("Phone");
            //foreach (var categories in goodsFromCategories)
            //{
            //	foreach (var item in categories.Goods)
            //	{
            //		Console.WriteLine(
            //			$"{item.Category.CategoryID}-{item.Category.Name}-{item.Brand}-{item.Model}");
            //	}
            //}
            //Console.WriteLine("\n");

            //#endregion

            //#region Second point "Define all Suppliers of Category"
            //Console.WriteLine("Second point \"Define all Suppliers of Category\"\n");
            //Console.WriteLine("2.1		Get Suppliers from Category By Id \n");
            //var categorySuppliers = category.GetById(1).Goods;
            //foreach (var item in categorySuppliers)
            //{
            //	Console.WriteLine($"{item.Supplier.Name}-{item.Supplier.City}");
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("2.2		Get Suppliers from Category By categoru name (Registed of literals is not important)\n");
            //Console.WriteLine("With upper");
            //var category_Suppliers1 = supplier.GetSuppliersFromCategory("Phone");
            //foreach (var item in category_Suppliers1)
            //{
            //	Console.WriteLine($"{item.SupplierID} - {item.Name} - {item.City.CityName}");
            //}
            //Console.WriteLine("\n");
            //OR
            //Console.WriteLine("__________OR_________");
            //Console.WriteLine("With all lower\n");
            //var category_Suppliers2 = supplier.GetSuppliersFromCategory("phone");
            //foreach (var item in category_Suppliers2)
            //{
            //	Console.WriteLine($"{item.SupplierID} - {item.Name} - {item.City.CityName}");
            //}
            //Console.WriteLine("\n");
            //#endregion
            //#region Third point "Define all Goods of Supplier"
            //Console.WriteLine("Third point \"Define all Goods of Supplier\"\n");
            //Console.WriteLine("3.1		Get suppliers goods by his Id\n");
            //var goodsOfSupplier = supplier.GetById(1).Goods;
            //foreach (var item in goodsOfSupplier)
            //{
            //	Console.WriteLine($"{item.Supplier.Name} - {item.Brand} - {item.Model}");
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("3.2		Get suppliers goods by his name\n");
            //var goodsofSupplier = good.GetGoodsFromSupplier("ClothSeller");
            //foreach (var item in goodsofSupplier)
            //{
            //	Console.WriteLine($"{item.Supplier.Name} - {item.Brand} - {item.Model}");
            //}
            //Console.WriteLine("\n");
            //#endregion
            //#region Second point "To Find some goods by criteria"
            //Console.WriteLine("Second point \"To Find some goods by criteria\"\n");
            //Console.WriteLine("4.1		MAX PRICE\n");
            //var goodsMaxPrice = good.GetGoodsWithMaxPrice();
            //foreach (var item in goodsMaxPrice)
            //{
            //	Console.WriteLine($"Goods with max price - {item.Brand} - {item.Model} - {item.Price}");
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("4.2		MIN PRICE\n");
            //var goodsMinPrice = good.GetGoodsWithMinPrice();
            //foreach (var item in goodsMinPrice)
            //{
            //	Console.WriteLine($"Goods with min price - {item.Brand} - {item.Model} - {item.Price}");
            //}
            //Console.WriteLine("\n");
            //Console.WriteLine("4.3		Goods from the City by id\n");
            //var goodsFromCity = good.Find(x => x.Supplier.City.CiteID == 2);
            //foreach (var item in goodsFromCity)
            //{
            //	Console.WriteLine($"Goods From {item.Supplier.City.CityName} - {item.Brand} - {item.Model}");
            //}
            //#endregion


            Console.ReadKey();
        }
Example #18
0
 public GoodsController(IGoodService goodService)
 {
     _goodService = goodService;
 }
Example #19
0
 public CartController(IGoodService goodService, ICartService cartService)
 {
     this.goodService = goodService;
     this.cartService = cartService;
 }
Example #20
0
 public MainController(IGoodService goodService, ICategoryService category, ICookieConsumer storage)
     : base(storage)
 {
     _categoryService = category;
     _goodService     = goodService;
 }
Example #21
0
 public HomeController(IGoodService s)
 {
     service = s;
 }
Example #22
0
 public UserController(IUserService userService, IGoodService goodService)
 {
     _userService = userService;
     _goodService = goodService;
 }
Example #23
0
 public GoodService(IGoodService goodService, IGoodRepository goodRepository)
 {
     _goodService    = goodService;
     _goodRepository = goodRepository;
 }
Example #24
0
 public GoodController(IPhotoRepository photo, ICookieConsumer storage, IGoodService goodService)
 {
     _storage     = storage;
     _goodService = goodService;
     _photo       = photo;
 }
        public ActionResult addGoods()
        {
            service = new GoodService();

            swapperService     = new SwapperService();
            categoryService    = new CategoryService();
            subCategoryService = new SubCategoryService();


            int connectedSwapper = 1; // connected swapper -identity

            swapper user = swapperService.Get(u => u.id_swapper == connectedSwapper);

            ViewBag.user = user;


            string   brand       = Request.Form["brand"];
            string   description = Request.Form["desc"];
            DateTime date        = DateTime.Now;
            int      validity    = 0;
            int      quantity    = int.Parse(Request.Form["quantity"]);
            string   label       = Request.Form["label"];
            Accpted  accepted    = Accpted.no;

            int catId = int.Parse(Request.Form["cat"]);
            //category cat = categoryService.Get(c => c.id_category == catId);

            int subCatId = int.Parse(Request.Form["subCat"]);
            //subCategory subCat = subCategoryService.Get(sc => sc.id_subCategory == subCatId);

            goods newGood = new goods();

            newGood.label       = label;
            newGood.brand       = brand;
            newGood.description = description;
            newGood.date        = date;
            newGood.validity    = validity;
            newGood.quantity    = quantity;
            newGood.accepted    = accepted;

            //subCat.category = cat;

            newGood.subCategoryID = subCatId;
            newGood.swapperID     = user.id_swapper;
            service.Add(newGood);
            service.Commit();



            if (Request.Files[0].ContentLength > 0) // on a ajouté une image pour le produit
            {
                byte[] file = null;
                using (var binaryReader = new BinaryReader(Request.Files[0].InputStream))
                {
                    file = binaryReader.ReadBytes(Request.Files[0].ContentLength);
                }


                Image img = this.byteArrayToImage(file);
                img = new Bitmap(img, new Size(180, 180));

                string path = "~/swapperImgs/" + newGood.id_goods + ".jpg";
                img.Save(Server.MapPath(path), System.Drawing.Imaging.ImageFormat.Jpeg);


                newGood.image = path;
                service.Update(newGood);
                service.Commit();
            }



            return(RedirectToAction("SearchGood"));
        }
 public ValuesController(IGoodService goodService)
 {
     _goodService = goodService;
 }
        public ActionResult SaveMyGood(GoodModels GM)
        {
            System.Diagnostics.Debug.WriteLine("------------------------------------   :    " + GM.goood.id_goods);


            service = new GoodService();

            swapperService     = new SwapperService();
            categoryService    = new CategoryService();
            subCategoryService = new SubCategoryService();


            int connectedSwapper = 1;

            swapper user = swapperService.Get(u => u.id_swapper == connectedSwapper);

            ViewBag.user = user;


            string   brand       = Request.Form["brand"];
            string   description = Request.Form["desc"];
            DateTime date        = DateTime.Now;
            int      validity    = 0;
            int      quantity    = int.Parse(Request.Form["quantity"]);
            string   label       = Request.Form["label"];

            int idGood = int.Parse(Request.Form["idGood"]);

            Accpted accepted = Accpted.no;

            int catId = int.Parse(Request.Form["cat"]);
            //category cat = categoryService.Get(c => c.id_category == catId);

            int subCatId = int.Parse(Request.Form["subCat"]);

            //subCategory subCat = subCategoryService.Get(sc => sc.id_subCategory == subCatId);

            GM.goood             = service.GetById(idGood);
            GM.goood.label       = label;
            GM.goood.brand       = brand;
            GM.goood.description = description;
            GM.goood.date        = date;
            GM.goood.validity    = validity;
            GM.goood.quantity    = quantity;
            GM.goood.accepted    = accepted;

            //subCat.category = cat;

            GM.goood.subCategoryID = subCatId;
            GM.goood.swapperID     = user.id_swapper;

            service.Update(GM.goood);
            service.Commit();



            if (Request.Files[0].ContentLength > 0)
            {
                byte[] file = null;
                using (var binaryReader = new BinaryReader(Request.Files[0].InputStream))
                {
                    file = binaryReader.ReadBytes(Request.Files[0].ContentLength);
                }


                Image img = this.byteArrayToImage(file);
                img = new Bitmap(img, new Size(180, 180));

                string path = "~/swapperImgs/" + GM.goood.id_goods + ".jpg";
                img.Save(Server.MapPath(path), System.Drawing.Imaging.ImageFormat.Jpeg);

                GM.goood.image = path;
                service.Update(GM.goood);
                service.Commit();
            }

            return(RedirectToAction("SearchMyGood"));
        }
Example #28
0
 public GoodController(IGoodService goodService)
 {
     this.goodService = goodService;
 }
Example #29
0
 public StoreController(IGoodService gd)
 {
     _goodService = gd;
 }