private void lstLockers_SelectedIndexChanged(object sender, EventArgs e) { if (lstLockers.SelectedIndex > -1) { btnAddNew.Visible = false; btnSave.Visible = true; lockItem = new Locker((int)lstLockers.SelectedValue); txtLockerName.Text = lockItem.getName(); } }
private void lstOpenLockers_SelectedIndexChanged(object sender, EventArgs e) { if (lstOpenLockers.SelectedIndex > -1) { chosenLocker = new Locker((int)lstOpenLockers.SelectedValue); lblLockerName.Text = chosenLocker.getName(); lblLockerAdmin.Text = chosenLocker.getKeyHolder1(); lblLockerLabUser.Text = chosenLocker.getKeyHolder2(); lblDateFrom.Text = myLogHangle.covertDateStringToString(chosenLocker.getDateFrom().ToString()); chosenLocker.assignDeviceList(lstLockerDevices); dateLockerTo.TodayDate = chosenLocker.getDateTo(); dateLockerTo.SetDate(chosenLocker.getDateTo()); TimeSpan temp = chosenLocker.getDateTo() - DateTime.Today; lblLockersDLeft.Text = temp.Days.ToString() + " days left"; if (lstLockerDevices.Items.Count > 0) { lstLockerDevices.SelectedIndex = 0; lstLockerDevices_SelectedIndexChanged(sender, e); } else { lblLockerDName.Text = ""; lblLockerDIMIE.Text = ""; lblLockerDModel.Text = ""; lblLockerDSerial.Text = ""; imgLockerDimg.Image = imgList.Images[3]; } } else { lblLockerName.Text = ""; lblLockerAdmin.Text = ""; lblLockerLabUser.Text = ""; lblDateFrom.Text = ""; dateLockerTo.TodayDate = DateTime.Now; dateLockerTo.SetDate(DateTime.Now); lblLockersDLeft.Text = ""; lblLockerDName.Text = ""; lblLockerDIMIE.Text = ""; lblLockerDModel.Text = ""; lblLockerDSerial.Text = ""; imgLockerDimg.Image = imgList.Images[3]; } }