private void button1_Click(object sender, EventArgs e) { if (selectMemberControl1.SelectedMembers.Count == 0) { MessageBox.Show("请选择会员!"); selectMemberControl1.Focus(); return; } Followup followup = new Followup(); followup.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member; followup.回访方式 = comboBox3.SelectedItem as FollowupType; followup.跟进结果 = comboBox7.SelectedItem as FollowupResult; followup.跟进时间 = DateTime.Parse(textBox3.Text.Trim()); followup.跟进人 = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null; followup.备注 = textBox6.Text; FollowupLogic rl = FollowupLogic.GetInstance(); int id = rl.AddFollowup(followup); if (id > 0) { followup.ID = id; LoadFollowups(); MessageBox.Show("添加成功!"); } }
private DataTable Search(string name, int sex = 0, FollowupType follType = null, FollowupResult follResult = null, string mobile = null) { string nm = ""; if (!string.IsNullOrEmpty(name) && name.Trim() != "") { nm = " and 会员 like '%" + name + "%'"; } string sx = ""; if (sex > 0) { sx = " and 性别='" + (性别)Enum.ToObject(typeof(性别), (sex - 1)) + "'"; } string ft = ""; if (follType != null) { ft = " and 回访方式='" + follType.方式 + "'"; } string fr = ""; if (follResult != null) { fr = " and 跟进结果='" + follResult.结果 + "'"; } string mb = ""; if (!string.IsNullOrEmpty(mobile) && mobile.Trim() != "") { mb = " and 电话 like '%" + mobile.Trim() + "%'"; } string where = "(1=1)" + nm + sx + ft + fr + mb; return(FollowupLogic.GetInstance().GetFollowups(where)); }
private void button2_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (selectMemberControl1.SelectedMembers.Count == 0) { MessageBox.Show("请选择会员!"); selectMemberControl1.Focus(); return; } Followup followup = (Followup)comboBox1.SelectedItem; followup.Member = selectMemberControl1.SelectedMembers[0];//comboBox2.SelectedItem as Member; followup.回访方式 = comboBox3.SelectedItem as FollowupType; followup.跟进结果 = comboBox7.SelectedItem as FollowupResult; followup.跟进时间 = DateTime.Parse(textBox3.Text.Trim()); followup.跟进人 = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null; followup.备注 = textBox6.Text; FollowupLogic rl = FollowupLogic.GetInstance(); if (rl.UpdateFollowup(followup)) { LoadFollowups(); MessageBox.Show("修改成功!"); } } else { MessageBox.Show("先选定要修改的回访记录!"); } }
private void LoadFollowups() { List <Followup> elements = FollowupLogic.GetInstance().GetAllFollowups(); comboBox1.Items.Clear(); foreach (Followup element in elements) { comboBox1.Items.Add(element); } dataGridView1.DataSource = FollowupLogic.GetInstance().GetFollowups(string.Empty); }
private void button3_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (MessageBox.Show("确定要删除该回访记录?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { Followup followup = (Followup)comboBox1.SelectedItem; if (FollowupLogic.GetInstance().DeleteFollowup(followup)) { LoadFollowups(); } } } else { MessageBox.Show("先选定要删除的回访记录!"); } }