public bool UpdateFollowupResult(FollowupResult element) { string sql = "update TF_FollowupResult set 结果='" + element.结果 + "', Flag=" + (element.Flag ? "1" : "0") + ", 备注='" + element.备注 + "' where ID=" + element.ID; int r = sqlHelper.ExecuteSql(sql); return(r > 0); }
public bool DeleteFollowupResult(FollowupResult element) { string sql = "delete from TF_FollowupResult where ID=" + element.ID; int r = sqlHelper.ExecuteSql(sql); return(r > 0); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { FollowupResult followupResult = comboBox1.SelectedItem as FollowupResult; if (followupResult != null) { textBox1.Text = followupResult.结果; textBox2.Text = followupResult.备注; checkBox1.Checked = followupResult.Flag; } } }
public int AddFollowupResult(FollowupResult element) { string sql = "insert into TF_FollowupResult (结果, Flag, 备注) values ('" + element.结果 + "', " + (element.Flag ? "1" : "0") + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
private int GetIndexByFollowupResult(FollowupResult follResult, ComboBox comboBox4) { if (follResult != null && comboBox4 != null) { for (int i = 0; i < comboBox4.Items.Count; i++) { FollowupResult ct = comboBox4.Items[i] as FollowupResult; if (ct != null && ct.ID == follResult.ID) { return(i); } } } return(-1); }
public FollowupResult GetFollowupResult(int id) { string sql = "select * from TF_FollowupResult where ID=" + id; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { FollowupResult element = new FollowupResult(); element.ID = id; element.结果 = dt.Rows[0]["结果"].ToString(); element.Flag = Convert.ToBoolean(dt.Rows[0]["Flag"]); element.备注 = dt.Rows[0]["备注"].ToString(); return(element); } return(null); }
private void button3_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { if (MessageBox.Show("确定要删除该跟进结果?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { FollowupResult followupResult = (FollowupResult)comboBox1.SelectedItem; if (FollowupResultLogic.GetInstance().DeleteFollowupResult(followupResult)) { LoadFollowupResults(); } } } else { MessageBox.Show("先选定要删除的跟进结果!"); } }
public List <FollowupResult> GetAllFollowupResults() { List <FollowupResult> elements = new List <FollowupResult>(); string sql = "select * from TF_FollowupResult"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { FollowupResult element = new FollowupResult(); element.ID = Convert.ToInt32(dt.Rows[i]["ID"]); element.结果 = dt.Rows[i]["结果"].ToString(); element.Flag = Convert.ToBoolean(dt.Rows[i]["Flag"]); element.备注 = dt.Rows[i]["备注"].ToString(); elements.Add(element); } } return(elements); }
private void button2_Click(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { FollowupResult followupResult = (FollowupResult)comboBox1.SelectedItem; followupResult.结果 = textBox1.Text.Trim(); followupResult.备注 = textBox2.Text.Trim(); followupResult.Flag = checkBox1.Checked; FollowupResultLogic al = FollowupResultLogic.GetInstance(); if (al.ExistsNameOther(followupResult.结果, followupResult.ID)) { if (MessageBox.Show("系统中已经存在该跟进结果,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { if (al.UpdateFollowupResult(followupResult)) { LoadFollowupResults(); MessageBox.Show("修改成功!"); } } else { textBox1.Focus(); textBox1.SelectAll(); } } else { if (al.UpdateFollowupResult(followupResult)) { LoadFollowupResults(); MessageBox.Show("修改成功!"); } } } else { MessageBox.Show("先选定要修改的跟进结果!"); } }
private void button1_Click(object sender, EventArgs e) { FollowupResult followupResult = new FollowupResult(); followupResult.结果 = textBox1.Text.Trim(); followupResult.备注 = textBox2.Text.Trim(); followupResult.Flag = checkBox1.Checked; FollowupResultLogic al = FollowupResultLogic.GetInstance(); if (al.ExistsName(followupResult.结果)) { if (MessageBox.Show("系统中已经存在该跟进结果,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { int id = al.AddFollowupResult(followupResult); if (id > 0) { followupResult.ID = id; LoadFollowupResults(); MessageBox.Show("添加成功!"); } } else { textBox1.Focus(); textBox1.SelectAll(); } } else { int id = al.AddFollowupResult(followupResult); if (id > 0) { followupResult.ID = id; LoadFollowupResults(); 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)); }