private void button2_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { Workplan workplan = (Workplan)comboBox1.SelectedItem; workplan.销售 = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null; workplan.日期 = DateTime.Parse(textBox3.Text.Trim()); workplan.带人数 = (int)numericUpDown1.Value; workplan.号码数 = (int)numericUpDown2.Value; workplan.成单数 = (int)numericUpDown3.Value; workplan.回访数 = (int)numericUpDown4.Value; workplan.备注 = textBox6.Text; WorkplanLogic rl = WorkplanLogic.GetInstance(); if (rl.UpdateWorkplan(workplan)) { LoadWorkplans(); MessageBox.Show("修改成功!"); } } else { MessageBox.Show("先选定要修改的工作计划!"); } }
public List <Workplan> GetAllWorkplans() { List <Workplan> elements = new List <Workplan>(); string sql = "select * from TF_Workplan"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { Workplan element = new Workplan(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.销售 = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[i]["销售"])); element.日期 = Convert.ToDateTime(dt.Rows[i]["日期"]); element.带人数 = Convert.ToInt32(dt.Rows[i]["带人数"]); element.号码数 = Convert.ToInt32(dt.Rows[i]["号码数"]); element.成单数 = Convert.ToInt32(dt.Rows[i]["成单数"]); element.回访数 = Convert.ToInt32(dt.Rows[i]["回访数"]); element.备注 = dt.Rows[i]["备注"].ToString(); elements.Add(element); } } return(elements); }