예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="customers"></param>
 /// <param name="context"></param>
 public OrderService(
     ICustomerService customers,
     TinyCrmDbContext context)
 {
     context_   = context;
     customers_ = customers;
 }
 public ProductController(
     TinyCrmDbContext context,
     IProductService products)
 {
     context_  = context;
     products_ = products;
 }
예제 #3
0
 public OrderServiceTests(TinyCrmFixture fixture)
 {
     context_   = fixture.DbContext;
     customers_ = fixture.Container.Resolve <ICustomerService>();
     orders_    = fixture.Container.Resolve <IOrderService>();
     products_  = fixture.Container.Resolve <IProductService>();
 }
예제 #4
0
        public IActionResult Privacy()
        {
            using (var context = new TinyCrmDbContext())
            {
                var customerService = new CustomerService(context);
            }

            return(View());
        }
예제 #5
0
 public void Orders_Retrieve()
 {
     using (var context = new TinyCrmDbContext()) {
         var orders = context
                      .Set <Order>()
                      .Include(o => o.Customer)
                      .ToList();
     }
 }
예제 #6
0
 public OrderService(
     TinyCrmDbContext context,
     ICustomerService customer,
     IProductService product)
 {
     context_   = context;
     customers_ = customer;
     products_  = product;
 }
예제 #7
0
 public OrderService(
     TinyCrmDbContext context,
     ICustomerService custService,
     IProductService prodService)
 {
     context_        = context;
     customerService = custService;
     productService  = prodService;
 }
예제 #8
0
 public OrderService(
     TinyCrmDbContext context,
     ICustomerService customers,
     IProductService products)
 {
     context_  = context;
     customer_ = customers;
     product_  = products;
 }
예제 #9
0
 public void Customer_Order_Retrieve()
 {
     using (var context = new TinyCrmDbContext()) {
         var customer = context
                        .Set <Customer>()
                        .Where(c => c.VatNumber == "117003949")
                        .FirstOrDefault();
         Assert.NotNull(customer);
     }
 }
예제 #10
0
 public ReportService(
     TinyCrmDbContext context,
     ICustomerService customer,
     IProductService product,
     IOrderService order)
 {
     context_  = context;
     customer_ = customer;
     product_  = product;
     order_    = order;
 }
예제 #11
0
        public void RetrieveContacts()
        {
            var customerId = AddCustomerContacts();

            using (var context = new TinyCrmDbContext()) {
                var contacts = context
                               .Set <Customer>()
                               .Include(c => c.Contacts) // fernei sigkekrimena antikeimena apo tin vasi
                               .Where(c => c.Id == customerId)
                               .Select(c => c.Contacts)
                               .ToList();
            }
        }
예제 #12
0
        static void Main(string[] args)
        {
            using (var context = new TinyCrmDbContext())
            {
                ICustomerService customerService = new CustomerService(context);
                IProductService  productService  = new ProductService(context);

                //context.Add(
                //new Product
                //{
                //    Name = "iPhone",
                //    Price = 1000,
                //    InStock = 100,
                //    Id = "123",
                //    Category = ProductCategory.Smartphones
                //});

                //context.Add(
                //    new Product
                //    {
                //        Name = "Nikon",
                //        Price = 599,
                //        InStock = 74,
                //        Id = "345",
                //        Category = ProductCategory.Cameras
                //    });
                //context.SaveChanges();

                //var sum = productService.SumOfStocks();

                //var options = new SearchCustomerOptions
                //{
                //    VatNumber = 123456789
                //};


                var customer = new Customer()
                {
                };

                context.Set <Customer>().Add(customer);
                context.SaveChanges();
                //return customer;
                //var results = customerService.Create(Customer);

                //var options = new SearchCustomerOptions
                //{
                //    FirstName = "itr"
                //};
            }
        }
예제 #13
0
        public IActionResult Privacy()
        {
            using (var context = new TinyCrmDbContext()) {
                var customerService = new CustomerService(context);

                var customer = customerService.SearchCustomers(
                    new SearchCustomerOptions()
                {
                    CustomerId = 1
                }).SingleOrDefault();

                return(Json(customer));
            }
        }
예제 #14
0
 public void Customer_Order_Success()
 {
     using (var context = new TinyCrmDbContext()) {
         var customer = new Customer()
         {
             VatNumber = "117003949",
             Email     = "*****@*****.**",
         };
         customer.Orders.Add(
             new Order()
         {
             DeliveryAddress = "Kleemann Kilkis"
         });
         context.Add(customer);
         context.SaveChanges();
     }
 }
예제 #15
0
        static void Main(string[] args)
        {
            using (var context = new TinyCrmDbContext())
            {
                var customerService = new CustomerService(context);

                var newCustomer = customerService.CreateCustomer(new CustomerOptions()
                {
                    FirstName = "Avraam",
                    LastName  = "Liaoutsis",
                    VatNumber = "1313-asdASD=123",
                    IsActive  = true
                });


                //var newProduct = productService.Create(new
                //    ProductOptions()
                //{
                //    Name = "Mac os",
                //    Category = ProductCategory.Laptops,
                //    Price = 500,
                //    ProductId = "ASDASD1-242"
                //}
                //);

                //var productsToBuy = new List<Product>();
                //var productsIdsToBuy = new List<string>();

                //productsToBuy.Add(newProduct);
                //productsIdsToBuy.Add(newProduct.ProductId);


                //var newOrder = orderService.CreateOrder(new OrderOptions()
                //{
                //    CustomerId = newCustomer.Id,
                //    ProductIds = productsIdsToBuy
                //});

                //Console.WriteLine(newOrder);



                context.Dispose();
            }
        }
예제 #16
0
 public int AddCustomerContacts()
 {
     using (var context = new TinyCrmDbContext()) {
         var customer = new Customer()
         {
             Firstname = "George",
             Lastname  = "Stathis",
             Email     = "*****@*****.**"
         };
         var Contacts = new ContactPerson()
         {
             Email = "*****@*****.**"
         };
         customer.Contacts.Add(Contacts);
         context.Add(customer);
         context.SaveChanges();
         return(customer.Id);
     }
 }
예제 #17
0
        static void Main(string[] args)
        {
            using (var context = new TinyCrmDbContext())
            {
                ICustomerService customerService = new CustomerService(
                    context);
                IProductService productService = new ProductService(
                    context);
                IOrderService orderService = new OrderService(
                    context, custService, prodService);

                var customer = customerService.CreateCustomer(
                    new CreateCustomerOptions()
                {
                    FirstName = "Dimitris",
                    LastName  = "Pnevmatikos",
                    VatNumber = "123456789"
                });
            }
        }
예제 #18
0
 public ProductService(TinyCrmDbContext context)
 {
     context_ = context;
 }
 public CustomerService(TinyCrmDbContext context)
 {
     context_ = context;
 }
예제 #20
0
파일: Program.cs 프로젝트: stafylas/TinyCrm
        static void Main(string[] args)
        {
            //Log.Logger = new LoggerConfiguration()
            //    .WriteTo.Console()
            //    .WriteTo.File($@"{System.IO.Directory.GetCurrentDirectory()}\logs\{DateTime.Now:yyyy-MM-dd}\log-.txt",
            //        rollingInterval: RollingInterval.Day)
            //    .CreateLogger();
            //Log.Error("this is an error");
            //Console.ReadKey();

            var context = new TinyCrmDbContext();

            // Console.WriteLine(context.Database.CanConnect());
            context.Database.EnsureCreated();

            //var p = new Product()
            //{
            //    Id = "3455",
            //    ProductCategory = ProductCategory.Computers,
            //    Price = 99.99M,
            //    Discount = 0
            //};
            //var c1 = new Customer()
            //{
            //    Email = "*****@*****.**",
            //    Firstname = "kostas",
            //    Lastname = "papadopoulos",
            //    Phone = "698965663 ",
            //    VatNumber = " RDJ234",
            //    Created = DateTimeOffset.Now
            //};


            //context.Add(c1);
            //context.SaveChanges();

            //context.Remove(c1);
            //context.SaveChanges();


            //var y= context.Set<Customer>() //anazitisi
            //  .Where(o => o.Id == 4)
            //  .ToList();             //vazoume .tolist giati to antikeimeno pou epstrefei den einai kanoniko antikeimno
            // context.Remove(y[0]);
            // context.SaveChanges();

            //var q = context.Set<Customer>()
            //     .Where(o => o.Id == 2);
            //var customer = q.SingleOrDefault();



            var productService = new ProductService(context);

            productService.AddProduct(
                new AddProductOptions()
            {
                Id              = "12345",
                Price           = 153.33M,
                ProductCategory = ProductCategory.Cameras,
                Name            = "Camera 1"
            });
            productService.AddProduct(
                new AddProductOptions()
            {
                Id              = "4556",
                Price           = 613.33M,
                ProductCategory = ProductCategory.Cameras,
                Name            = "camera 2"
            });
            productService.UpdateProduct("123",
                                         new UpdatedProductOptions()
            {
                Price = 22.22M
            });
            Console.WriteLine(productService.GetProductById("12345"));

            string path = @"C:/Users/KCA9/Downloads/kl-oop-master/kl-oop-master/products.csv";

            productService.readFile(path);
        }
예제 #21
0
 public OrderService(TinyCrmDbContext context, ICustomerService customerService)
 {
     context_         = context;
     customerService_ = customerService;
 }
예제 #22
0
 public CustomerServiceTests()
 {
     context_ = new TinyCrmDbContext();
 }
예제 #23
0
 public OrderService(TinyCrmDbContext context, ICustomerService customerService, IProductService productService)
 {
     _context         = context;
     _customerService = customerService;
     _productService  = productService;
 }
예제 #24
0
 public ProductService(TinyCrmDbContext ctx)  //na tin perasw pantoy
 {
     context = ctx ??
               throw new ArgumentNullException(nameof(ctx));
 }
예제 #25
0
 public HomeController()
 {
     context          = new TinyCrmDbContext();
     customerService_ = new CustomerService(
         context);
 }
예제 #26
0
 public CustomerController()
 {
     _dbContext       = new TinyCrmDbContext();
     _customerService = new CustomerService(_dbContext);
 }
예제 #27
0
 public CustomerController()
 {
     dbContext_       = new TinyCrmDbContext();
     customerService_ = new CustomerService(dbContext_);
 }
예제 #28
0
 public ProductService(TinyCrmDbContext ctx)
 {
     context = ctx ??
               throw new ArgumentNullException(nameof(ctx));
 }
 public ProductService(TinyCrmDbContext dbContext)
 {
     context = dbContext;
 }
예제 #30
0
 public OrderService(ICustomerService cService, TinyCrmDbContext context)
 {
     dbContext       = context;
     customerService = cService;
     productService  = new ProductService(dbContext);
 }