private void 修改Button_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { Dairy dairy = (Dairy)comboBox1.SelectedItem; 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(); if (al.UpdateDairy(dairy)) { LoadDairys(); MessageBox.Show("修改成功!"); } } else { MessageBox.Show("先选定要修改的业绩!"); } }
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("添加成功!"); } }
private DataTable Search(DateTime start, DateTime end, string staff) { string jsr = ""; if (!string.IsNullOrEmpty(staff) && staff.Trim() != "") { jsr = " and 经手人 like '%" + staff.Trim() + "%'"; } string where = "(1=1)" + jsr + " and (日期 >= '" + start + "' and 日期 < '" + end.AddDays(1) + "')"; return(DairyLogic.GetInstance().GetDairys(where)); }
private void LoadDairys() { List <Dairy> elements = DairyLogic.GetInstance().GetAllDairys(); comboBox1.Items.Clear(); foreach (Dairy element in elements) { comboBox1.Items.Add(element); } dataGridView1.DataSource = DairyLogic.GetInstance().GetDairys(string.Empty); }
private void 除Button_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (MessageBox.Show("确定要删除该业绩?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { Dairy alert = (Dairy)comboBox1.SelectedItem; if (DairyLogic.GetInstance().DeleteDairy(alert)) { LoadDairys(); } } } else { MessageBox.Show("先选定要删除的业绩!"); } }