private void DisplayList()
    {
        LbContacts.Items.Clear();
        Customer item;

        for (int i = 0; i < cus.Count(); i++)
        {
            item = cus[i];
            LbContacts.Items.Add(item.Display());
        }
    }
        /// <summary>
        /// The OnDelete
        /// </summary>
        private async void OnDelete()
        {
            await DialogHost.Show(new MessageView(), "RootDialog", delegate(object sender, DialogClosingEventArgs args)
            {
                if (Equals(args.Parameter, false))
                {
                    return;
                }

                if (Equals(args.Parameter, true))
                {
                    _context.Users.Remove(SelectedUserAccount);


                    _context.SaveChanges();
                    DoRefresh(null);
                }
            });

            if (IsByUser == true)
            {
                TotalCount = UserAccountList.Count();
            }
            else
            {
                TotalCount = CustomerList.Count();
            }
        }
示例#3
0
 private void btnAddCustomer_Click(object sender, EventArgs e)
 {
     if (tbxFörnamn.Text != "" && tbxEfternamn.Text != "" && tbxAdress.Text != "" && tbxTelefonnummer.Text != "")
     {
         Customer newCustomer = new Customer((customerList.Count() + 1), tbxFörnamn.Text, tbxEfternamn.Text, tbxAdress.Text, tbxTelefonnummer.Text);
         customerList.Add(newCustomer);
         updateListView();
         tbxAdress.Clear();
         tbxEfternamn.Clear();
         tbxFörnamn.Clear();
         tbxTelefonnummer.Clear();
         tbxFörnamn.Focus();
     }
     else
     {
         MessageBox.Show("Fyll i alla rutorna!");
     }
 }
示例#4
0
        static void TestListConstructorsandAdd()
        {
            Console.WriteLine();
            Console.WriteLine("testing class list");
            CustomerList customers = new CustomerList();
            Customer     c1        = new Customer("Michael", "Michaelerson", "*****@*****.**");

            customers.Add(c1);
            Console.WriteLine("testing the count() and deafult constructor");
            double count = customers.Count();

            Console.WriteLine("should be a count of 1:  " + count);
            Console.WriteLine("testing if overload add works. Also test if deafult int[i] indexer works");

            customers.Add("fred", "fredderson", "*****@*****.**");
            Console.WriteLine("should display fred fredderson at [email protected]");
            Console.WriteLine(customers[1].ToString());
            Console.WriteLine("testing email indexer");
            Console.WriteLine("expecting 1" + customers["*****@*****.**"].ToString());
            //Console.WriteLine("expecting error" + customers["fredfredderson"]);
        }
示例#5
0
        private void updateCustomerListView()
        {
            //Gör en kopia av listviewen i AddCustomer (Exakt samma kod, annat namn på lvwBokaKund)

            lvwBokaKund.Items.Clear();
            string[]     columns = new string[5];
            ListViewItem KundItem;

            for (int i = 0; i < customerList.Count(); i++)
            {
                columns[0] = customerList.Get(i).CustomerID.ToString();
                columns[1] = customerList.Get(i).Förnamn;
                columns[2] = customerList.Get(i).Efternamn;
                columns[3] = customerList.Get(i).Adress;
                columns[4] = customerList.Get(i).Telefonnummer;
                KundItem   = new ListViewItem(columns);
                lvwBokaKund.Items.Add(KundItem);
            }
            for (int i = 0; i < columns.Length; i++)
            {
                lvwBokaKund.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }