Esempio n. 1
0
        private void FilllistviewRent()
        {
            this.listViewRent.Items.Clear();
            this.rents = Rent.GetCurrentRents(this.connection);
            ListViewItem item = null;

            foreach (Rent rent in rents)
            {
                item      = new ListViewItem();
                item.Text = rent.Modell;
                item.SubItems.Add(rent.Brand);
                item.SubItems.Add(rent.Name);
                item.SubItems.Add(rent.FamilyName);
                if (rent.Begin.HasValue)
                {
                    item.SubItems.Add($"{rent.Begin.Value.ToShortDateString()} - {rent.Begin.Value.ToShortTimeString()}");
                }
                else
                {
                    item.SubItems.Add("");
                }
                if (rent.End.HasValue)
                {
                    item.SubItems.Add($"{rent.End.Value.ToShortDateString()} - {rent.End.Value.ToShortTimeString()}");
                }
                else
                {
                    item.SubItems.Add("");
                }
                item.Tag = rent;
                this.listViewRent.Items.Add(item);
            }
        }
Esempio n. 2
0
 public List <RentContract> CustomerLogin(int cid)
 {
     try
     {
         List <RentContract> result = new List <RentContract>();
         Rent.GetCurrentRents(cid).ForEach(v => result.Add((RentContract)v));
         return(result);
     }
     catch (Exception ex)
     {
         WriteLog($"Error on GET: {ex.Message}");
         return(new List <RentContract>());
     }
 }