Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Smartphone sp = new Smartphone();
            sp.Modello = "ABC";
            sp.Marca = "X";
            Console.WriteLine(sp.Modello);

            Cliente c = new Cliente("Antonio", "Pelleriti");
            Console.WriteLine(c.NomeCompleto);
        }
Ejemplo n.º 2
0
        public void SmartphoneMakeCallsTest()
        {
            var smartphone = new Smartphone();
            var call       = new Call(smartphone);
            var device     = new Device(call);

            var phoneNumber = "8380910769";
            var action      = call.MakeCall(phoneNumber);

            var expected = "Calling 8380910769 ...";
            var actual   = device.PerformAction(action);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
    static void Main(string[] args)
    {
        Smartphone phone = new Smartphone("Smartphone",
                                          Console.ReadLine()
                                          .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                          .ToList(),
                                          Console.ReadLine()
                                          .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                          .ToList()
                                          );

        phone.PhoneNumbersList.ForEach(n => Console.WriteLine(phone.PrintPhoneNumber(n)));
        phone.UrlList.ForEach(u => Console.WriteLine(phone.PrintUrl(u)));
    }
Ejemplo n.º 4
0
        public void SmartphoneAccessInternetTest()
        {
            var smartphone = new Smartphone();
            var feature    = new AdditionalFeatures(smartphone);
            var device     = new Device(feature);

            var url    = "www.google.com";
            var action = feature.AccessInternet(url);

            var expected = "Connecting to \"www.google.com\" ...";
            var actual   = device.PerformAction(action);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 5
0
    static void Main()
    {
        const int SIZE = 3;

        Device[] d = new Device[SIZE];
        d[0] = new Smartphone(1.5, 5.6);
        d[1] = new Tablet(2.3, 8.9);
        d[2] = new Computer(4.4, 45.9);

        foreach (Device dev in d)
        {
            Console.WriteLine(dev);
        }
    }
        public IHttpActionResult DeleteSmartphone(int id)
        {
            Smartphone smartphone = db.Smartphones.Find(id);

            if (smartphone == null)
            {
                return(NotFound());
            }

            db.Smartphones.Remove(smartphone);
            db.SaveChanges();

            return(Ok(smartphone));
        }
Ejemplo n.º 7
0
    private static void Main()
    {
        List <string> phoneNumbers = Console.ReadLine()
                                     .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                     .ToList();
        List <string> urls = Console.ReadLine()
                             .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                             .ToList();

        Smartphone phone = new Smartphone(phoneNumbers, urls);

        phone.Call();
        phone.Browse();
    }
Ejemplo n.º 8
0
 private static void BrowseWebsites(Smartphone smartphone)
 {
     foreach (var website in smartphone.Websites)
     {
         try
         {
             Console.WriteLine(smartphone.BrowseWebsite(website));
         }
         catch (ArgumentException ae)
         {
             Console.WriteLine(ae.Message);
         }
     }
 }
Ejemplo n.º 9
0
        public void SmartphonePlayMusicTest()
        {
            var smartphone = new Smartphone();
            var feature    = new AdditionalFeatures(smartphone);
            var device     = new Device(feature);

            var songTitle = "In The End.mp3";
            var action    = feature.PlayMusic(songTitle);

            var expected = "Playing In The End.mp3 ...";
            var actual   = device.PerformAction(action);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 10
0
 private static void CallNumbers(Smartphone smartphone)
 {
     foreach (var phoneNumber in smartphone.PhoneNumbers)
     {
         try
         {
             Console.WriteLine(smartphone.CallNumber(phoneNumber));
         }
         catch (ArgumentException ae)
         {
             Console.WriteLine(ae.Message);
         }
     }
 }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            SimCard simCard = new SimCard("+38(096)5236888");

            simCard.AddContact(new Contact("Mum", "+38(096)5236845"));
            simCard.AddContact(new Contact("Dad", "+38(096)5236889"));
            Contact brother = new Contact("Brother", "+38(096)5233873");

            brother.Numbers.Add("+38(093)5233779");
            simCard.AddContact(brother);

            LandlinePhone landlinePhone = new LandlinePhone(2005);

            landlinePhone.Number = "596235";
            ThomasEdisonPhone thomasEdisonPhone = new ThomasEdisonPhone(1980);

            thomasEdisonPhone.Number = "562348";
            CellPhone  cellphone  = new CellPhone(2011, 5, simCard);
            Smartphone smartphone = new Smartphone(2018, 48, "Android", simCard);
            VideoPhone videoPhone = new VideoPhone(2017, 24, simCard);

            User user = new User("Daria");

            Console.WriteLine("LandlinePhone");
            user.CallAnotherUser("395698", landlinePhone);
            Console.WriteLine("*************************");
            user.AcceptIncomingCall("798562", landlinePhone);
            Console.WriteLine("*************************");
            Console.WriteLine("ThomasEdisonPhone");
            user.CallAnotherUser("984256", thomasEdisonPhone);
            Console.WriteLine("*************************");
            user.AcceptIncomingCall("658423", thomasEdisonPhone);
            Console.WriteLine("*************************");
            Console.WriteLine("CellPhone");
            user.CallAnotherUser("Mum", cellphone);
            Console.WriteLine("*************************");
            user.AcceptIncomingCall("+38(096)5236889", cellphone);
            Console.WriteLine("*************************");
            Console.WriteLine("Smartphone");
            user.CallAnotherUser("+38(097)5428953", smartphone);
            Console.WriteLine("*************************");
            user.AcceptIncomingCall("+38(097)5428953", smartphone);
            Console.WriteLine("*************************");
            Console.WriteLine("VideoPhone");
            user.CallAnotherUser("+38(097)5428988", videoPhone);
            Console.WriteLine("*************************");
            user.AcceptIncomingCall("+38(097)5477753", videoPhone);
            Console.WriteLine("*************************");
            Console.ReadLine();
        }
Ejemplo n.º 12
0
        private async void AddItem(object sender, RoutedEventArgs e)
        {
            var dialogo = GenerarDialogo();

            // Lanzar dialogo
            await dialogo.ShowAsync();

            if (MasterListView.SelectedIndex == -1)
            {
                MasterListView.SelectedIndex      = 0;
                smartphoneSeleccionado            = MasterListView.SelectedItem as Smartphone;
                DetailContentPresenter.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 13
0
    static void Main(string[] args)
    {
        var smartphone = new Smartphone(Console.ReadLine().Split(' '), Console.ReadLine().Split(' '));

        foreach (var number in smartphone.PhoneNumbersArray)
        {
            Console.WriteLine(smartphone.CallNumber(number));
        }

        foreach (var site in smartphone.SitesArray)
        {
            Console.WriteLine(smartphone.BrowseSite(site));
        }
    }
Ejemplo n.º 14
0
        // GET: Smartphones/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Smartphone smartphone = db.Smartphones.Find(id);

            if (smartphone == null)
            {
                return(HttpNotFound());
            }
            return(View(smartphone));
        }
Ejemplo n.º 15
0
 public static void VisitASite(string site, Smartphone phone)
 {
     try
     {
         if (site.Any(n => Char.IsDigit(n)))
         {
             throw new ArgumentException("Invalid URL!");
         }
         Console.WriteLine(phone.VisitSite(site));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
        public bool Update(Smartphone phone)
        {
            using (SqlConnection con = new SqlConnection(DBConnectionString.Get()))
            {
                string query = "UPDATE Smartphones SET Title = @Title, Description = @Description, Price = @Price WHERE Id = @Id";
                var    cmd   = new SqlCommand(query, con);
                cmd.Parameters.AddWithValue("@Title", phone.Title);
                cmd.Parameters.AddWithValue("@Description", phone.Description);
                cmd.Parameters.AddWithValue("@Price", phone.Price);
                cmd.Parameters.AddWithValue("@Id", phone.Id);

                con.Open();
                return(cmd.ExecuteNonQuery() == 1);
            }
        }
Ejemplo n.º 17
0
    public static void Main()
    {
        const int NUMDEVICES = 10;

        Device[] d = new Device[NUMDEVICES];
        d[0] = new Smartphone(4000, 7);
        d[1] = new Computer(12000, 24);
        d[2] = new Tablet(9999, 13);
        foreach (Device x in d)
        {
            Console.WriteLine(x);
        }

        // TO DO: Ask the user and show data
    }
Ejemplo n.º 18
0
        public void SmartphoneTextMessageTest()
        {
            var smartphone = new Smartphone();
            var text       = new TextMessage(smartphone);
            var device     = new Device(text);

            var phoneNumber = "8380910769";
            var message     = "Hello World!";
            var action      = text.SendTextMessage(message, phoneNumber);

            var expected = "Sending \"Hello World!\" to 8380910769 ...";
            var actual   = device.PerformAction(action);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 19
0
        public void Run()
        {
            string[] phoneNum = Console.ReadLine().Split();
            string[] urlData  = Console.ReadLine().Split();
            var      temp     = new Smartphone();

            foreach (var phoneNumbers in phoneNum)
            {
                Console.WriteLine(temp.Call(phoneNumbers));
            }
            foreach (var url in urlData)
            {
                Console.WriteLine(temp.Browsing(url));
            }
        }
Ejemplo n.º 20
0
 public static void CallNumber(string number, Smartphone phone)
 {
     try
     {
         if (number.Any(n => !Char.IsDigit(n)))
         {
             throw new ArgumentException("Invalid number!");
         }
         Console.WriteLine(phone.CallPhone(number));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }
Ejemplo n.º 21
0
    static void Main(string[] args)
    {
        Smartphone smartphone = new Smartphone();

        string[] nums = Console.ReadLine().Split();
        foreach (var num in nums)
        {
            smartphone.Call(num);
        }
        string[] sites = Console.ReadLine().Split();
        foreach (var site in sites)
        {
            smartphone.Browse(site);
        }
    }
Ejemplo n.º 22
0
    public static void Main()
    {
        var phone   = new Smartphone();
        var numbers = Console.ReadLine().Split().ToList();
        var sites   = Console.ReadLine().Split().ToList();

        foreach (var number in numbers)
        {
            phone.Call(number);
        }
        foreach (var site in sites)
        {
            phone.Browse(site);
        }
    }
Ejemplo n.º 23
0
 private static void Browsing(string[] webSites)
 {
     foreach (var site in webSites)
     {
         try
         {
             Smartphone smartphoneBrowse = new Smartphone(site);
             smartphoneBrowse.Browse();
         }
         catch (ArgumentException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Ejemplo n.º 24
0
    static void Main(string[] args)
    {
        var numbers = Console.ReadLine().Split();
        var sites   = Console.ReadLine().Split();

        foreach (var number in numbers)
        {
            ICallable nums = new Smartphone();
            Console.WriteLine(nums.Calling(number));
        }
        foreach (var s in sites)
        {
            IBrowsable site = new Smartphone();
            Console.WriteLine(site.Browsing(s));
        }
    }
Ejemplo n.º 25
0
    static void Main()
    {
        Smartphone smartphone = new Smartphone();

        string[] phoneNumbers = Console.ReadLine().Split();
        string[] sites        = Console.ReadLine().Split();

        foreach (var number in phoneNumbers)
        {
            smartphone.MakeACall(number);
        }
        foreach (var site in sites)
        {
            smartphone.BrowseTheWeb(site);
        }
    }
Ejemplo n.º 26
0
    static void Main()
    {
        var phoneNums = Console.ReadLine().Split(' ');
        var webSites  = Console.ReadLine().Split(' ');

        var smartphone = new Smartphone();

        foreach (var phoneNum in phoneNums)
        {
            Console.WriteLine(smartphone.Call(phoneNum));
        }
        foreach (var webSite in webSites)
        {
            Console.WriteLine(smartphone.Browse(webSite));
        }
    }
Ejemplo n.º 27
0
    static void Main()
    {
        var phoneInput   = Console.ReadLine()?.Split();
        var websiteInput = Console.ReadLine()?.Split();

        Smartphone smartphone = new Smartphone();

        foreach (var number in phoneInput)
        {
            Console.WriteLine(smartphone.Calling(number));
        }
        foreach (var site in websiteInput)
        {
            Console.WriteLine(smartphone.Browsing(site));
        }
    }
 public SmartphonesViewModel(Product product, Smartphone smartphone)
 {
     this.ProductId       = product.ID;
     this.CategoryID      = product.CategoryID;
     this.OS              = product.OS;
     this.Processor       = product.Processor;
     this.Name            = product.Name;
     this.RAM             = product.RAM;
     this.Storage         = product.Storage;
     this.SmartphonesInfo = product.Name + " with processor " + product.Processor;
     this.Price           = (double)product.Price;
     this.Camera          = smartphone.Camera;
     this.SIMCardType     = smartphone.SIMCardType;
     this.ImagePath       = Path.Combine(Constants.ImagesSmartphonesDirectory, product.ImageName);
     this.CategoryType    = product.Category.Name;
 }
Ejemplo n.º 29
0
    static void Main(string[] args)
    {
        var smartphone    = new Smartphone();
        var inputNumbers  = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        var inputWebsites = Console.ReadLine().Split(new char[] { ' ', '\t' });

        foreach (var number in inputNumbers)
        {
            smartphone.MakeCall(number);
        }

        foreach (var website in inputWebsites)
        {
            smartphone.Browse(website);
        }
    }
Ejemplo n.º 30
0
    public static void Main()
    {
        Smartphone ipon = new Smartphone();

        ipon.Name = "Ipon";
        ipon.Rom  = 32;       // 32 GB
        ipon.Ram  = 4;        // 4 GB
        Console.WriteLine("The Price of Smartphone " + ipon.Name + " with ROM " + ipon.Rom + "GB and RAM " + ipon.Ram + "GB is Rp " + ipon.getPrice());

        Smartphone samsul = new Smartphone();

        samsul.Name = "Samsul";
        samsul.Rom  = 16;       // 16 GB
        samsul.Ram  = 4;        // 4 GB
        Console.WriteLine("The Price of Smartphone " + samsul.Name + " with ROM " + samsul.Rom + "GB and RAM " + samsul.Ram + "GB is Rp " + samsul.getPrice());
    }
Ejemplo n.º 31
0
    static void Main(string[] args)
    {
        Device[] devices = new Device[6];

        devices[0] = new Device(256, 3.5f);
        devices[1] = new Tactile(300, 2.5f);
        devices[2] = new Smartphone(12, 5f);
        devices[3] = new Tablet(24, 10);
        devices[4] = new WithKeyBoard(200, 4.5f);
        devices[5] = new Computer(1000, 8.7f);

        for (int i = 0; i < devices.Length; i++)
        {
            Console.WriteLine(devices[i].ToString());
        }
    }
Ejemplo n.º 32
0
 static void Main(string[] args)
 {
     Smartphone sp = new Smartphone();
     Smartphone.TelephoneNumber primo = sp[0];
 }