private void 添加Button_Click(object sender, EventArgs e) { Dairy dairy = new Dairy(); dairy.Pos机会籍 = numericUpDown1.Value; dairy.Pos机私教 = numericUpDown2.Value; dairy.现金会籍 = numericUpDown3.Value; dairy.现金私教 = numericUpDown4.Value; dairy.微信会籍 = numericUpDown9.Value; dairy.微信私教 = numericUpDown8.Value; dairy.现金存水 = numericUpDown5.Value; dairy.微信存水 = numericUpDown10.Value; dairy.水吧余 = numericUpDown6.Value; dairy.总金额 = numericUpDown7.Value; dairy.经手人 = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null; dairy.日期 = dateTimePicker3.Value; dairy.备注 = textBox2.Text; DairyLogic al = DairyLogic.GetInstance(); int id = al.AddDairy(dairy); if (id > 0) { dairy.ID = id; LoadDairys(); MessageBox.Show("添加成功!"); } }