Exemple #1
0
        public void TestMethod1()
        {
            var name     = new Name("Thiago", "Fernando");
            var document = new Document("01746592109");
            var email    = new Email("*****@*****.**");


            var c          = new Custumer(name, document, email, "122342444");
            var mouse      = new Product("Mouse", "Rato", "image.png", 69.45M, 10);
            var teclado    = new Product("Keyboard", "Teclado sem fio", "image3.png", 79.45M, 130);
            var impressora = new Product("Impressora", "Impressora", "print.png", 619.45M, 1);



            var order = new Order(c);

            order.AddItem(new OrderItem(mouse, 4));
            order.AddItem(new OrderItem(teclado, 4));
            order.AddItem(new OrderItem(impressora, 4));

            //realizei o pedido
            order.Place();

            //Simular Pagamento
            order.Pay();

            //Simular envio
            order.Ship();

            //simular o cancelamento
            order.Cancel();
        }
Exemple #2
0
        public void Create(Custumer_Model model)
        {
            var data = Connect_Enttity.Custumers.FirstOrDefault(x => x.iusid == model.iusid);

            if (data == null)
            {
                var entity = new Custumer();
                entity.iusid       = model.iusid;
                entity.vusername   = model.vusername;
                entity.vpassword   = model.vpassword;
                entity.vcusname    = model.vcusname;
                entity.dbirthday   = model.dbirthday;
                entity.vprovince   = model.vprovince;
                entity.vaddress    = model.vaddress;
                entity.vphone      = model.vphone;
                entity.vmobile     = model.vmobile;
                entity.vemail      = model.vemail;
                entity.dcreatedate = Convert.ToDateTime(model.dcreatedate);
                entity.istatus     = (short)(model.istatus);

                Connect_Enttity.Custumers.Add(entity);
                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Exemple #3
0
        public async Task <ActionResult <Custumer> > PostCustumer(Custumer custumer)
        {
            _context.Custumers.Add(custumer);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCustumer", new { id = custumer.Id }, custumer));
        }
Exemple #4
0
        public async Task <IActionResult> PutCustumer(int id, Custumer custumer)
        {
            if (id != custumer.Id)
            {
                return(BadRequest());
            }

            _context.Entry(custumer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustumerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public List <Custumer> GetCostumers(string telef)
        {
            List <Custumer> listuser = new List <Custumer>();
            string          token    = CreatLidAlfa();
            var             data     = new
            {
                page  = 0,
                phone = telef
            };
            string contentText = JsonConvert.SerializeObject(data).ToString();

            using (xNet.HttpRequest reqtok = new xNet.HttpRequest())
            {
                reqtok.AddHeader("X-ALFACRM-TOKEN", token);
                string  content   = reqtok.Post("https://legionsport.s20.online/v2api/1/customer/index", contentText, "application/json").ToString();
                var     converter = new ExpandoObjectConverter();
                dynamic obj       = JsonConvert.DeserializeObject <ExpandoObject>(content, converter);

                foreach (var item in obj.items)
                {
                    Custumer user = new Custumer();
                    user.Id       = item.id;
                    user.BierzDay = item.dob;
                    user.FullName = item.name;
                    user.Object   = item.custom_obekt;
                    user.Gruop    = item.custom_gruppa;
                    user.Telef1   = item.phone[0];
                    user.Telef2   = item.phone[1];
                    listuser.Add(user);
                }
            }
            return(listuser);
        }
Exemple #6
0
 //Constructors
 public Account(Custumer custumer, DateTime startDate, decimal startBallance, decimal interestRate)
 {
     this.Custumer                 = custumer;
     this.StartAccountDate         = startDate;
     this.BallanceInEuro           = startBallance;
     this.InterestRateMonthlyBased = interestRate;
 }
        public IActionResult Index()
        {
            List <Custumer> custumers = new List <Custumer>();

            var Custumer1 = new Custumer("Søren", "N", "Helvedes Kerne 666", "6666", "Hell");

            Custumer1.AddPhone("91243454");
            Custumer1.AddPhone("21245432");
            Custumer1.Birthdate = new DateTime(1994, 2, 12);
            var Custumer2 = new Custumer("Jesus", "Christ", "Heaven road 888", "420", "Sky");

            Custumer2.AddPhone("12832912");
            Custumer2.AddPhone("90823712");
            Custumer2.Birthdate = new DateTime(1992, 11, 12);
            var Custumer3 = new Custumer("Leif", "Dahlgaard", "Ingen fast Adresse", "0000", "Frederiks");

            Custumer3.AddPhone("90128312");
            Custumer3.AddPhone("12039231");
            Custumer3.Birthdate = new DateTime(1992, 11, 12);



            custumers.Add(Custumer1);
            custumers.Add(Custumer2);
            custumers.Add(Custumer3);


            ViewBag.custumers = custumers;
            return(View());
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Custumer custumer = db.Custumers.Find(id);

            db.Custumers.Remove(custumer);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #9
0
        public bool Valid()
        {
            AddNotifications(new ValidationContract().Requires()
                             .HasLen(Custumer.ToString(), 36, "Customer", "Identificador do cliente é inválido")
                             .IsGreaterThan(OrderItems.Count, 0, "Items", "Nenum item foi encotrado")
                             );

            return(IsValid);
        }
 public ActionResult Edit([Bind(Include = "CustumerId,Name,ContacFirsName,ContacLastName,Phone,Address,Email,DocumentTypeId,Document")] Custumer custumer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(custumer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DocumentTypeId = new SelectList(db.DocumentTypes, "DocumentTypeId", "Description", custumer.DocumentTypeId);
     return(View(custumer));
 }
        // GET: Custumers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Custumer custumer = db.Custumers.Find(id);

            if (custumer == null)
            {
                return(HttpNotFound());
            }
            return(View(custumer));
        }
        // GET: Custumers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Custumer custumer = db.Custumers.Find(id);

            if (custumer == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DocumentTypeId = new SelectList(db.DocumentTypes, "DocumentTypeId", "Description", custumer.DocumentTypeId);
            return(View(custumer));
        }
Exemple #13
0
        public static List <Custumer> GetCustumers()
        {
            var customers = new List <Custumer>();

            for (int index = 0; index <= 50; index++)
            {
                var customer = new Custumer();
                customer.Id   = index;
                customer.Name = $"Customer{index}";
                customer.Age  = 19 + index;

                customers.Add(customer);
            }
            return(customers);
        }
        public async Task <IActionResult> Post([FromBody] RegisterCustumerModel model)
        {
            var unitOfWork = new OrderUnityOfWork();


            var custumer = new Custumer(name: model.Name, id: model.Id);

            var custumerRepository = new CustumerRepository(unitOfWork);

            await custumerRepository.Add(custumer);

            unitOfWork.BeginTansaction();
            await custumerRepository.Add(custumer);

            await unitOfWork.Commit();

            return(Ok());
        }
Exemple #15
0
        static void Main()
        {
            var alphaBank      = new Bank();
            var telerikCompany = new Custumer(CustumerType.Company, "Telerik Progress Company");
            var telerikDeposit = new Deposit(telerikCompany, DateTime.Parse("05/10/2010"), 10000m, 10m);

            //Add one deposit account in bank
            alphaBank.BankAccounts.Add(telerikDeposit);

            Console.WriteLine("Test Adding account in Bank! Count= " + alphaBank.BankAccounts.Count);

            //Add two more acounts in bank - 1x Loan and 1x Mortgage
            alphaBank.BankAccounts.Add(new Loan(new Custumer(CustumerType.Company, "Telerik Progress Company"), DateTime.Parse("20/06/2012"), 5000m, 20m));
            alphaBank.BankAccounts.Add(new Mortgage(new Custumer(CustumerType.Company, "Telerik Progress Company"), DateTime.Parse("30/06/2014"), 20000m, 15m));

            // Test - Print Initial ballance of all accounts
            foreach (var account in alphaBank.BankAccounts)
            {
                Console.WriteLine(String.Format("\nInitial Ballance in {0} account is {1} EUR!", account.GetType(), account.BallanceInEuro));
            }

            //Add three more acounts in bank - CustumerType = Individual - 1x Deposit, 1x Loan and 1x Mortgage
            alphaBank.BankAccounts.Add(new Deposit(new Custumer(CustumerType.Individual, "Ivan Ivanov"), DateTime.Parse("10/06/2000"), 1000m, 20m));
            alphaBank.BankAccounts.Add(new Loan(new Custumer(CustumerType.Individual, "Petar Petrov"), DateTime.Parse("15/01/2002"), 500m, 20m));
            alphaBank.BankAccounts.Add(new Mortgage(new Custumer(CustumerType.Individual, "Dimitar Dimitrov"), DateTime.Parse("01/02/2008"), 20000m, 8m));

            //Calculating Interest Rate Up To NOW for All Accounts
            Console.WriteLine("\n\nCalculating Interest Rate Up To NOW for All Accounts:");
            foreach (var account in alphaBank.BankAccounts)
            {
                Console.WriteLine("\nAccount Type: " + account.GetType());
                Console.WriteLine(String.Format("Interest Rate for {0} account since {1:dd/MM/yyyy} to {2:dd/MM/yyyy} is {3:F2} EUR!", account.Custumer.CustumerName, account.StartAccountDate.Date, DateTime.Now.Date, account.CalculateInterestForDate(DateTime.Now)));

                Console.WriteLine(String.Format("Ballance for {0} account since {1:dd/MM/yyyy} to {2:dd/MM/yyyy} is {3:F2} EUR!", account.Custumer.CustumerName, account.StartAccountDate.Date, DateTime.Now.Date, account.BallanceInEuro));
            }
            Console.WriteLine();
        }
Exemple #16
0
 //Constructors
 public Loan(Custumer custumer, DateTime startDate, decimal startBallance, decimal interestRate) : base(custumer, startDate, startBallance, interestRate)
 {
 }
Exemple #17
0
 public Account(decimal balance, decimal interestRate, Custumer custumer)
 {
     this.Balance      = balance;
     this.InterestRate = interestRate;
     this.Custumer     = custumer;
 }
Exemple #18
0
 public static void Print(Custumer custumer)
 {
     Console.WriteLine($"Nome: {custumer.Name}, Idade: {custumer.Age}");
 }
Exemple #19
0
 protected Order(DateTime orderDate, List <OrderItem> orderItem, Custumer custumer)
 {
     OrderDate = orderDate;
     OrderItem = orderItem;
     Custumer  = custumer;
 }
Exemple #20
0
        static repository()
        {
            //objects
            //Music
            var Beatles = new MusicCD("Beatles", "Abbey Road", 125, 26 - 9 - 1969, "/Images/abbey.jfif");

            Beatles.AddTracks(new Track("Come together", "John Lennon", new TimeSpan(0, 7, 30)));
            Beatles.AddTracks(new Track("Something", "John Lennon", new TimeSpan(0, 5, 34)));
            Beatles.AddTracks(new Track("Maxwell's Silver Hammer", "Paul Mccartney", new TimeSpan(0, 5, 34)));
            Beatles.AddTracks(new Track("Oh! Darling", "", new TimeSpan(0, 3, 20)));
            Beatles.AddTracks(new Track("Octopus's Darling", "John Lennon", new TimeSpan(0, 2, 10)));

            var Veto = new MusicCD("VETO", "There's a Beat in All Machines", 190, 27 - 2 - 2006, "/Images/veto.jfif");

            Veto.AddTracks(new Track("Can you see anything", "Troels Abrahamsen", new TimeSpan(0, 3, 42)));
            Veto.AddTracks(new Track("We are not friends", "Troels Abrahamsen", new TimeSpan(0, 4, 12)));
            Veto.AddTracks(new Track("You Are a Knife", "VETO", new TimeSpan(0, 3, 32)));

            //books
            Book b1 = new Book("Stanley Kubrick", "The Shining", 150, 28 - 1 - 1977, "/Images/shining.jfif");
            Book b2 = new Book("Gud", "Biblen", 250, 0 - 0 - 0, "/Images/bible.jfif");

            //Movies
            // create a new Movie object with instance name jungleBook
            var jungle = new Movie("Jungle Book", 160.50m, "/Images/junglebook.jpg", "Jon Favreau");

            // assign a ViewBag property to the new Movie object


            // create a new Movie object with instance name jungleBook
            var gladiator = new Movie("Gladiator", 160.50m, "/Images/gladiator.jpg", "Ridley Scott");

            var forrestgump = new Movie("Forrest Gump", 160.50m, "/Images/forrest-gump.jpg", "Rasmus Haahr");

            // assign a ViewBag property to the new Movie object

            Products.Add(Beatles);
            Products.Add(Veto);
            Products.Add(b1);
            Products.Add(b2);
            Products.Add(jungle);
            Products.Add(gladiator);
            Products.Add(forrestgump);

            //custumers
            var Custumer1 = new Custumer("Søren", "N", "Helvedes Kerne 666", "6666", "Hell");


            var Custumer2 = new Custumer("Jesus", "Christ", "Heaven road 888", "420", "Sky");

            var Custumer3 = new Custumer("Leif", "Dahlgaard", "Ingen fast Adresse", "0000", "Frederiks");

            //Orderitems
            var Order1 = new OrderItem(jungle, 2);
            var Order2 = new OrderItem(Veto, 1);
            var Order3 = new OrderItem(gladiator, 3);
            var Order4 = new OrderItem(Beatles, 2);

            //Invoices

            var I1 = new Invoice(1, DateTime.Now, Custumer1);

            I1.AddOrderItems(Order1);
            I1.AddOrderItems(Order2);
            var I2 = new Invoice(2, DateTime.Now, Custumer2);

            I2.AddOrderItems(Order3);
            I2.AddOrderItems(Order4);

            Invoices.Add(I1);
            Invoices.Add(I2);
        }
Exemple #21
0
 public Custumer createCustumer(Custumer custurmer)
 {
     return(custurmer);
 }
 protected Account(decimal balance, decimal interestRate, Custumer custumer)
 {
     this.Balance = balance;
     this.InterestRate = interestRate;
     this.Custumer = custumer;
 }