public bool UpdateFollowupType(FollowupType element) { string sql = "update TF_FollowupType set 方式='" + element.方式 + "', Flag=" + (element.Flag ? "1" : "0") + ", 备注='" + element.备注 + "' where ID=" + element.ID; int r = sqlHelper.ExecuteSql(sql); return(r > 0); }
public bool DeleteFollowupType(FollowupType element) { string sql = "delete from TF_FollowupType where ID=" + element.ID; int r = sqlHelper.ExecuteSql(sql); return(r > 0); }
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 comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedIndex > -1) { FollowupType followupType = comboBox1.SelectedItem as FollowupType; if (followupType != null) { textBox1.Text = followupType.方式; textBox2.Text = followupType.备注; checkBox1.Checked = followupType.Flag; } } }
public int AddFollowupType(FollowupType element) { string sql = "insert into TF_FollowupType (方式, 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 GetIndexByFollowupType(FollowupType follType, ComboBox comboBox3) { if (follType != null && comboBox3 != null) { for (int i = 0; i < comboBox3.Items.Count; i++) { FollowupType ct = comboBox3.Items[i] as FollowupType; if (ct != null && ct.ID == follType.ID) { return(i); } } } return(-1); }
public FollowupType GetFollowupType(int id) { string sql = "select * from TF_FollowupType where ID=" + id; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { FollowupType element = new FollowupType(); 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) { FollowupType followupType = (FollowupType)comboBox1.SelectedItem; if (FollowupTypeLogic.GetInstance().DeleteFollowupType(followupType)) { LoadFollowupTypes(); } } } else { MessageBox.Show("先选定要删除的回访方式!"); } }
public List <FollowupType> GetAllFollowupTypes() { List <FollowupType> elements = new List <FollowupType>(); string sql = "select * from TF_FollowupType"; DataTable dt = sqlHelper.Query(sql); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { FollowupType element = new FollowupType(); 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) { FollowupType followupType = (FollowupType)comboBox1.SelectedItem; followupType.方式 = textBox1.Text.Trim(); followupType.备注 = textBox2.Text.Trim(); followupType.Flag = checkBox1.Checked; FollowupTypeLogic al = FollowupTypeLogic.GetInstance(); if (al.ExistsNameOther(followupType.方式, followupType.ID)) { if (MessageBox.Show("系统中已经存在该回访方式,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { if (al.UpdateFollowupType(followupType)) { LoadFollowupTypes(); MessageBox.Show("修改成功!"); } } else { textBox1.Focus(); textBox1.SelectAll(); } } else { if (al.UpdateFollowupType(followupType)) { LoadFollowupTypes(); MessageBox.Show("修改成功!"); } } } else { MessageBox.Show("先选定要修改的回访方式!"); } }
private void button1_Click(object sender, EventArgs e) { FollowupType followupType = new FollowupType(); followupType.方式 = textBox1.Text.Trim(); followupType.备注 = textBox2.Text.Trim(); followupType.Flag = checkBox1.Checked; FollowupTypeLogic al = FollowupTypeLogic.GetInstance(); if (al.ExistsName(followupType.方式)) { if (MessageBox.Show("系统中已经存在该回访方式,确定还要继续保存么?", "重名提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { int id = al.AddFollowupType(followupType); if (id > 0) { followupType.ID = id; LoadFollowupTypes(); MessageBox.Show("添加成功!"); } } else { textBox1.Focus(); textBox1.SelectAll(); } } else { int id = al.AddFollowupType(followupType); if (id > 0) { followupType.ID = id; LoadFollowupTypes(); MessageBox.Show("添加成功!"); } } }