Exemplo n.º 1
0
 private void btnDeleteRecordDelete_Click(object sender, RoutedEventArgs e)
 {
     if (cbRecordID.Text.Length > 0)
     {
         RecordList.DeleteRecord(int.Parse(cbRecordID.Text));
         grdMenu.Visibility         = Visibility.Visible;
         grdDeleteRecord.Visibility = Visibility.Hidden;
     }
 }
Exemplo n.º 2
0
        private void btnCreateRecordCreate_Click(object sender, RoutedEventArgs e)
        {
            if (tbAdress.Text.Length != 0 &&
                tbCost.Text.Length != 0 &&
                tbSquare.Text.Length != 0 &&
                tbRoomCount.Text.Length != 0)
            {
                try
                {
                    PremisesType typeOfPremisses =
                        cbPlacementType.Text == "Помещение" ?
                        PremisesType.Apartment :
                        PremisesType.Room;

                    string address       = tbAdress.Text;
                    int    square        = int.Parse(tbSquare.Text);
                    int    numberOfRooms = int.Parse(tbRoomCount.Text);
                    double price         = double.Parse(tbCost.Text);

                    Record record = new Record(
                        typeOfPremisses,
                        address,
                        square,
                        numberOfRooms,
                        price,
                        CurrentUser.Name,
                        CurrentUser.PhoneNumber);
                    RecordList.AddRecord(record);

                    grdCreateRecord.Visibility = Visibility.Hidden;
                    grdMenu.Visibility         = Visibility.Visible;

                    tbAdress.Text    = "";
                    tbCost.Text      = "";
                    tbSquare.Text    = "";
                    tbRoomCount.Text = "";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("error: empty fields");
            }
        }
Exemplo n.º 3
0
 private void Window_Closed(object sender, EventArgs e)
 {
     RecordList.SaveRecords();
 }
Exemplo n.º 4
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     LoadUsers();
     Record.LoadCurrentID();
     RecordList.LoadRecords();
 }