Exemplo n.º 1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(txtTotalBeds.Text) && !string.IsNullOrEmpty(cboGovernedBy.Text))
            {
                String beds = txtTotalBeds.Text;

                if (int.Parse(beds) <= 0)
                {
                    MessageBox.Show("No of beds should be a positive number.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                String strNid = cboGovernedBy.SelectedValue.ToString();

                int   TotalBeds = int.Parse(beds);
                int   nid       = int.Parse(strNid);
                nurse n         = hms.getNurseByNid(nid);
                room  r         = new room();
                r.totalbeds     = TotalBeds;
                r.availablebeds = TotalBeds;
                r.nurse         = n;
                String Nursename = cboGovernedBy.Text;

                hms.addRoom(r);
                RoomList.Add(r);
                this.Close();
            }
            else
            {
                MessageBox.Show("Make sure all fields are enered.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }