Ejemplo n.º 1
0
        private void ThemHang(object sender, RoutedEventArgs e)
        {
            if (!kiemtraHeSo(CoeffText.Text) || TOCText.Text.Length < 1)
            {
                MessageBox.Show("Bạn chưa nhập thông tin hoặc hệ số sai (hệ số bao gồm số từ 0->9 hoặc thêm dấu chấm nếu là số thực.", "Cảnh báo!!!", MessageBoxButton.OK);
                return;
            }
            MessageBoxResult result = MessageBox.Show("Bạn muốn thêm khách hàng?", "Xác nhận!!!", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                ListViewDataCustommer temp = new ListViewDataCustommer()
                {
                    STT = items.Count + 1, LoaiKhach = TOCText.Text, HeSo = float.Parse(CoeffText.Text)
                };

                if (connectData.setTypeOfCustomer(temp))
                {
                    items = connectData.getTypeOfCustommer();
                    lvTypeCustommer.ItemsSource = items;

                    TOCText.Text   = "";
                    CoeffText.Text = "";
                }
            }
        }
Ejemplo n.º 2
0
        private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListViewDataCustommer lvc = (ListViewDataCustommer)lvTypeCustommer.SelectedItem;

            if (lvc != null)
            {
                if (editAction)
                {
                    numSuportEdit  = 1;
                    Stttext        = lvc.STT;
                    TOCText.Text   = lvc.LoaiKhach.ToString();
                    CoeffText.Text = lvc.HeSo.ToString();
                }
            }
        }