예제 #1
0
        private void set_values(Headphone headphone)
        {
            item_id = headphone.id;
            item_name_textbox.Text = headphone.item_name;
            if (headphone.item_bought == DateTime.MinValue)
            {
                bought_date_checkbox.Checked = true;
            }
            else
            {
                dateTime_bought_picker.Value = headphone.item_bought;
                bought_date_checkbox.Checked = false;
            }

            if (headphone.item_retired == DateTime.MinValue)
            {
                retired_checkbox.Checked = true;
            }
            else
            {
                dateTime_retired_picker.Value = headphone.item_retired;
                retired_checkbox.Checked      = false;
            }
            price_textbox.Text             = headphone.price.ToString();
            description_textbox.Text       = headphone.description;
            company_name_textbox.Text      = headphone.company_name;
            rating_textbox.Text            = headphone.rating.ToString();
            cable_lenght_textbox.Text      = headphone.cable_lenght.ToString();
            microphone_checkbox.Checked    = headphone.microphone;
            volume_setter_checkbox.Checked = headphone.volume_setter;
            mute_button_checkbox.Checked   = headphone.mute_button;
        }
예제 #2
0
 public Computer(PowerSupply psu, Motherboard mb, Monitor monitor, RAM[] rams, GPU gpu, Keyboard kb = null, Mouse mouse = null, Headphone headphone = null, Microphone mic = null)
 {
     this.psu       = psu;
     this.mb        = mb;
     this.monitor   = monitor;
     this.rams      = rams;
     this.gpu       = gpu;
     this.kb        = kb;
     this.mouse     = mouse;
     this.headphone = headphone;
     this.mic       = mic;
 }
예제 #3
0
        public Add_Headphone(int mode, Headphone item)
        {
            InitializeComponent();
            this.mode = mode;
            add_headphone_button.Visible = false;
            modify_item_button.Visible   = false;

            if (mode == 0)
            {
                add_headphone_button.Visible = true;
            }
            else
            if (mode == 1)
            {
                modify_item_button.Visible = true;
                set_values(item);
            }
        }
예제 #4
0
        public void item_get_only_items_works()
        {
            List <Item> items = new List <Item> {
                new Item("tekst", new DateTime(), new DateTime(), 10f, "tmp", "comp", 3f),
                new Item("jjjj", new DateTime(), new DateTime(), 1f, "xxx", "yyy", 3f)
            };

            items.ForEach(w => item_Dao.add_item(w));


            Item      item      = new Item("new", new DateTime(), new DateTime(), 10f, "jjj", "xxxx", 1f);
            Headphone headphone = new Headphone(item, 10.3f, true, true, true);

            headphone_Dao.add_item(headphone);



            List <Item> returned_items = item_Dao.get_items_only();
            int         item_numbers   = returned_items.Count;

            Assert.AreEqual(2, item_numbers, "Count dont match!");
            Assert.IsTrue(compare_item_list(items, returned_items), "Items are not correct!");
        }