Beispiel #1
0
 public OperationResult <bool> Delete(int id)
 {
     if (id <= 0)
     {
         return(new OperationResult <bool>("Invalid id", Logger.LogEvent("Invalid id")));
     }
     try
     {
         var repository = new SellerRepository();
         var seller     = repository.ReadById(id);
         if (seller != null)
         {
             repository.Delete(id);
             return(new OperationResult <bool>(true));
         }
         else
         {
             return(new OperationResult <bool>("The specified id was not found", Logger.LogEvent("The specified id was not found")));
         }
     }
     catch (Exception ex)
     {
         return(new OperationResult <bool>("Error deleting the seller", Logger.LogEvent("Error deleting the seller")));
     }
 }
Beispiel #2
0
        public IActionResult AddSeller(AddSellerCommand newSeller)
        {
            var repo = new SellerRepository();

            newSeller.FirebaseUid = UserId;
            return(Ok(repo.AddSeller(newSeller)));
        }
Beispiel #3
0
        public void GetSeller_FailCase()
        {
            var sellerrepo = new SellerRepository(sellercontextmock.Object);
            var sellerlist = sellerrepo.GetSeller();

            Assert.AreNotEqual(2, sellerlist.Count);
        }
        static void Main(string[] args)
        {
            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();

            serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
            BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
            IDictionary props = new Hashtable();

            props["port"] = 55555;
            TcpChannel channel = new TcpChannel(props, clientProv, serverProv);

            ChannelServices.RegisterChannel(channel, false);

            ClientRepository clientRepository = new ClientRepository();
            MatchRepository  matchRepository  = new MatchRepository();
            SellerRepository sellerRepository = new SellerRepository();
            TicketRepository ticketRepository = new TicketRepository();
            var server = new ServiceImpl(clientRepository, matchRepository, sellerRepository, ticketRepository);

            //var server = new ChatServerImpl();
            RemotingServices.Marshal(server, "Chat");
            //RemotingConfiguration.RegisterWellKnownServiceType(typeof(ChatServerImpl), "Chat",
            //    WellKnownObjectMode.Singleton);

            // the server will keep running until keypress.
            Console.WriteLine("Server started ...");
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Beispiel #5
0
        public bool Save(Seller seller)
        {
            seller.Id = GetMaxSellerId();

            ISellerRepository repository = new SellerRepository();

            return(repository.Save(seller));
        }
 public ServiceImpl(ClientRepository clientRepository, MatchRepository matchRepository, SellerRepository sellerRepository, TicketRepository ticketRepository)
 {
     _clientRepository = clientRepository;
     _matchRepository  = matchRepository;
     _sellerRepository = sellerRepository;
     _ticketRepository = ticketRepository;
     loggedSellers     = new List <IObserver>();
 }
        public static IServices GetService()
        {
            ClientRepository clientRepository = new ClientRepository();
            MatchRepository  matchRepository  = new MatchRepository();
            SellerRepository sellerRepository = new SellerRepository();
            TicketRepository ticketRepository = new TicketRepository();

            return(new ServiceImpl(clientRepository, matchRepository, sellerRepository, ticketRepository));
        }
Beispiel #8
0
 public WatchBusiness(BrandRepository brandRepository, WatchRepository watchRepository, WatchBookmarkRepository bookmarkRepository, StoreRepository storeRepository, SellerRepository sellerRepository, SuggestPriceRepository suggestPriceRepository, UserRepository userRepository, UnitOfWork unitOfWork)
 {
     this.watchRepository        = watchRepository;
     this.bookmarkRepository     = bookmarkRepository;
     this.brandRepository        = brandRepository;
     this.unitOfWork             = unitOfWork;
     this.storeRepository        = storeRepository;
     this.sellerRepository       = sellerRepository;
     this.suggestPriceRepository = suggestPriceRepository;
     this.userRepository         = userRepository;
 }
Beispiel #9
0
        public void DeleteSeller(UpdateSellerCommand updatedSellerCommand, int id)
        {
            var repo = new SellerRepository();

            var deletedSeller = new Seller
            {
                Name = updatedSellerCommand.Name
            };

            repo.DeleteSeller(deletedSeller, id);
        }
Beispiel #10
0
        public async Task <IHttpActionResult> AddSeller([FromBody] Seller newSeller)
        {
            SellerRepository _repo = new SellerRepository();

            try
            {
                _repo.AddSeller(newSeller);
                return(StatusCode(HttpStatusCode.Created));
            }
            catch (Exception ex)
            {
                return(StatusCode(HttpStatusCode.BadRequest));
            }
        }
Beispiel #11
0
        public HttpResponseMessage ListOfSellers()
        {
            SellerRepository _repo = new SellerRepository();

            try
            {
                IEnumerable <Seller> list = _repo.ListOfSellers();
                return(Request.CreateResponse(HttpStatusCode.OK, list));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
                //return StatusCode(HttpStatusCode.BadRequest);
            }
        }
Beispiel #12
0
 public OperationResult <IEnumerable <SellerDTO> > ListSellers()
 {
     try
     {
         var sellers = new SellerRepository().Read();
         foreach (var item in sellers)
         {
             item.Nit = SecurityHelper.DecryptString(ENCRYPTION_KEY, item.Nit);
         }
         return(new OperationResult <IEnumerable <SellerDTO> >(sellers));
     }
     catch (Exception ex)
     {
         return(new OperationResult <IEnumerable <SellerDTO> >("Error listing the sellers", Logger.LogEvent(ex.Message)));
     }
 }
Beispiel #13
0
        private void InitialLoad()
        {
            var sellerRepository  = new SellerRepository();
            var clientRespository = new ClientRepository();

            cbSeller.DataSource    = sellerRepository.GetSellers();
            cbSeller.ValueMember   = "SellerID";
            cbSeller.DisplayMember = "SellerName";

            cbDocType.DataSource    = clientRespository.GetDocumentTypes();
            cbDocType.ValueMember   = "DocumentTypeID";
            cbDocType.DisplayMember = "Abreviation";

            cbDocTypeSearch.DataSource    = clientRespository.GetDocumentTypes();
            cbDocTypeSearch.ValueMember   = "DocumentTypeID";
            cbDocTypeSearch.DisplayMember = "Abreviation";
        }
 public UnitOfWork(ApplicationDbContext context)
 {
     this._context         = context;
     Categories            = new CategoryRepository(_context);
     Producers             = new ProducerRepository(_context);
     Roles                 = new RoleRepository(_context);
     Accounts              = new AccountRepository(_context);
     AvatarOfProducts      = new AvatarOfProductRepository(_context);
     Carts                 = new CartRepository(_context);
     Comments              = new CommentRepository(_context);
     Customers             = new CustomerRepository(_context);
     Invoices              = new InvoiceRepository(_context);
     Orders                = new OrderRepository(_context);
     Products              = new ProductRepository(_context);
     ProductsOfOrders      = new ProductsOfOrderRepository(_context);
     ProductSpecifications = new ProductSpecificationRepository(_context);
     SpecificationValues   = new SpecificationValueRepository(_context);
     StarRatings           = new StarRatingRepository(_context);
     Sellers               = new SellerRepository(_context);
 }
        static void Main(string[] args)
        {
            ICrudRepository <int, Game>   gameRepo   = new GameRepository();
            ICrudRepository <int, Ticket> ticketRepo = new TicketRepository();
            ICrudRepository <int, Seller> sellerRepo = new SellerRepository();
            GameService   gameService   = new GameService(gameRepo);
            TicketService ticketService = new TicketService(ticketRepo);
            SellerService sellerService = new SellerService(sellerRepo);
            IServer       serverImpl    = new ServerImplement(gameService, ticketService, sellerService);

            foreach (Seller s in sellerService.findAll())
            {
                Console.WriteLine(s);
                Console.WriteLine(s.Id);
            }
            MyServer server = new MyServer("127.0.0.1", 55560, serverImpl);

            server.Start();
            Console.WriteLine("Server started ...");
            Console.WriteLine("Press <enter> to exit...");
            Console.ReadLine();
        }
Beispiel #16
0
        private int GetMaxSellerId()
        {
            ISellerRepository repository = new SellerRepository();
            var sellers = repository.GetAll();

            if (sellers.Count == 0)
            {
                return(1);
            }
            else
            {
                int maxNumber = 0;
                foreach (var item in sellers)
                {
                    if (item.Id > maxNumber)
                    {
                        maxNumber = item.Id;
                    }
                }

                return(maxNumber + 1);
            }
        }
Beispiel #17
0
        public EfCorePersistence(IEfcoreDatabaseService efcoreDatabaseService)
        {
            _efcoreDatabaseService = efcoreDatabaseService;

            #region -Initialize Concrete Implementations of IRepository-
            //The concrete implementations need to be initialized improve this logic
            _addresses = new AddressRepository(_efcoreDatabaseService);

            _customers = new CustomerRepository(_efcoreDatabaseService);

            _categories = new CategoryRepository(_efcoreDatabaseService);

            _productcategories = new ProductCategoryRepository(_efcoreDatabaseService);

            _productimages = new ProductImageRepository(_efcoreDatabaseService);

            _products = new ProductRepository(_efcoreDatabaseService);

            _sellers = new SellerRepository(_efcoreDatabaseService);

            _users = new UserRepository(_efcoreDatabaseService);
            #endregion
        }
Beispiel #18
0
 public SellerController(SellerRepository _repository)
 {
     this._repository = _repository;
 }
Beispiel #19
0
        public ActionResult <Seller> GetSeller(string name)
        {
            var repo = new SellerRepository();

            return(repo.Get(name));
        }
 public void SetUp()
 {
     rep  = new ItemRepository(new EMartDBContext());
     srep = new SellerRepository(new EMartDBContext());
 }
Beispiel #21
0
 public void SetUp()
 {
     _srepo = new SellerRepository(new EmartDBContext());
     _irepo = new ItemRepository(new EmartDBContext());
 }
 public void Setup()
 {
     _repo  = new ItemRepository(new EmartDBContext());
     _repo1 = new SellerRepository(new EmartDBContext());
 }
 public void SetUp()
 {
     _repo     = new SellerRepository(new EMartDBContext());
     _itemrepo = new ItemRepository(new EMartDBContext());
 }
 public void setup()
 {
     _repo = new SellerRepository(new EmartDBContext());
 }
Beispiel #25
0
        public List <Seller> GetAll()
        {
            ISellerRepository repository = new SellerRepository();

            return(repository.GetAll());
        }
Beispiel #26
0
        public Seller GetByCpf(string cpf)
        {
            ISellerRepository repository = new SellerRepository();

            return(repository.GetByCpf(cpf));
        }
Beispiel #27
0
 public SellerController(IConfiguration configuration)
 {
     repo = new SellerRepository(configuration);
 }
Beispiel #28
0
 public void SetUp()
 {
     _repo = new SellerRepository(new SellerService.Models.EmartDBContext());
 }
Beispiel #29
0
 public void SetUp()
 {
     _repo = new SellerRepository(new EMARTDBContext());
 }
Beispiel #30
0
 private Facade()
 {
     OrderFacade    = new OrderRepository();
     SellerFacade   = new SellerRepository();
     PaymentsFacade = new PaymentsRepository();
 }