Exemplo n.º 1
0
        private void ThemHang(object sender, RoutedEventArgs e)
        {
            if (!kiemtraHeSo(CostText.Text) || TORText.Text.Length < 1 || !kiemtraHeSo(txtSKTD.Text))
            {
                MessageBox.Show("Bạn chưa nhập thông tin hoặc hệ số sai hoặc số khách tối đa sai (hệ số bao gồm số từ 0->9 hoặc thêm dấu chấm nếu là số thực. số khách tối đa phải là số nhỏ hơn bằng 3", "Cảnh báo!!!", MessageBoxButton.OK);
                return;
            }

            if (Convert.ToInt32(txtSKTD.Text) > Global.SoKhToiDa)
            {
                MessageBox.Show("Số khách tối đa phải là số nhỏ hơn bằng 3", "Cảnh báo!!!", MessageBoxButton.OK);
                return;
            }

            MessageBoxResult result = MessageBox.Show("Bạn muốn thêm loại phòng?", "Xác nhận!!!", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                ListViewDataRoom temp = new ListViewDataRoom()
                {
                    STT = items.Count + 1, LoaiPhong = TORText.Text, Dongia = float.Parse(CostText.Text), SoKhachToiDa = int.Parse(txtSKTD.Text)
                };

                if (connectData.setTypeOfRoom(temp))                            //set data in server
                {
                    items = connectData.getTypeOfRoom();
                    lvTypeRoom.ItemsSource = items;
                    TORText.Text           = "";
                    CostText.Text          = "";
                    txtSKTD.Text           = "";
                }
            }
        }
Exemplo n.º 2
0
        private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListViewDataRoom lvc = (ListViewDataRoom)lvTypeRoom.SelectedItem;

            if (lvc != null)
            {
                if (editAction)
                {
                    numSuportEdit = 1;
                    Stttext       = lvc.STT;
                    TORText.Text  = lvc.LoaiPhong.ToString();
                    CostText.Text = lvc.Dongia.ToString();
                    txtSKTD.Text  = lvc.SoKhachToiDa.ToString();
                }
            }
        }