Пример #1
0
        private void AddProvince_Btn_Click(object sender, RoutedEventArgs e)
        {
            province.Name       = ProvinceName_Txt.Text;
            province.CreateDate = DateTimeOffset.Now.LocalDateTime;
            var result = iProvince.Insert(province);

            if (result)
            {
                MessageBox.Show("Add Province Success");
                ProvinceName_Txt.Clear();
                dataGridProvince.ItemsSource = iProvince.Get();
            }
            else
            {
                MessageBox.Show("Add Province Failed");
                ProvinceName_Txt.Clear();
            }
        }
Пример #2
0
        private void UpdateProvince_Btn_Click(object sender, RoutedEventArgs e)
        {
            province.Name       = ProvinceName_Txt.Text;
            province.UpdateDate = DateTimeOffset.Now.LocalDateTime;
            int Id     = Convert.ToInt16(IdProvince_Txt.Text);
            var result = iProvince.Update(Id, province);

            if (result)
            {
                MessageBox.Show("Update Success");
                IdProvince_Txt.Clear();
                ProvinceName_Txt.Clear();
                dataGridProvince.ItemsSource = iProvince.Get();
            }
            else
            {
                MessageBox.Show("Update Failed");
            }
        }