示例#1
0
 public void button_dele(object sender, RoutedEventArgs e)
 {
     if (table.SelectedIndex >= 0)
     {
         int     oilsid = int.Parse(data.Rows[table.SelectedIndex]["oils_id"] + " ");
         OilsDAL dal    = new OilsDAL();
         dal.delOilsData(oilsid);
         initTable();
     }
     else
     {
         MessageBox.Show("没有选中项,无法删除");
     }
 }
示例#2
0
        private void Button_build(object sender, RoutedEventArgs e)
        {
            IsNumber Isnumber = new IsNumber();
            Oils     oils     = new Oils(id, name.Text, density.Text, viscosity.Text, masFlow.Text, outputByYear.Text, volume_concentration.Text);

            if (Isnumber.isNumber(density.Text.Trim()) == false || Isnumber.isNumber(viscosity.Text.Trim()) == false || Isnumber.isNumber(masFlow.Text.Trim()) == false || Isnumber.isNumber(outputByYear.Text.Trim()) == false || Isnumber.isNumber(volume_concentration.Text.Trim()) == false)
            {
                MessageBox.Show("输入格式有误");
            }
            else
            {
                OilsDAL dal = new OilsDAL();
                dal.delOilsData(id);
                dal.addOilsData(oils);
                MessageBox.Show("修改成功");
                Close();
            }
        }