private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "") { MessageBox.Show("输入查询条件!", "提示"); textBox1.Focus(); return; } tbTelRecordClass tbClass = new tbTelRecordClass(); tbTelRecordMenthod tbMenthod = new tbTelRecordMenthod(); tbClass.strfldTel = textBox1.Text; OleDbDataReader dr = tbMenthod.tbTelRecordSecrf(tbClass, "1"); dr.Read(); listView1.Items.Clear(); if (dr.HasRows) { listView1.Items.Add(dr[1].ToString()); listView1.Items[0].SubItems.Add(dr[2].ToString()); listView1.Items[0].SubItems.Add(dr[3].ToString()); listView1.Items[0].SubItems.Add(dr[5].ToString()); } // dr.Close(); }
private void button1_Click(object sender, EventArgs e) { tbTelRecordClass tbClass = new tbTelRecordClass(); tbTelRecordMenthod tbMenthod = new tbTelRecordMenthod(); tbClass.strsType = "´òÈë"; OleDbDataReader dr = tbMenthod.tbTelRecordSecrf(tbClass, "2"); listView1.Items.Clear(); int intFalg = 0; while (dr.Read()) { listView1.Items.Add(dr[1].ToString()); listView1.Items[intFalg].SubItems.Add(dr[2].ToString()); listView1.Items[intFalg].SubItems.Add(dr[3].ToString()); listView1.Items[intFalg].SubItems.Add(dr[5].ToString()); intFalg++; }// dr.Close(); }
}// end fi #endregion #region //查询电话记录返回 一个 OleDbDataReade 对象 public OleDbDataReader tbTelRecordSecrf(tbTelRecordClass Customer, string strFalg) { string strSecre = null; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); if (strFalg == "1") { strSecre = "select * from tb_TelRecord where fldTel like '%" + Customer.strfldTel + "%'"; } if (strFalg == "2") { strSecre = "select * from tb_TelRecord where sType = '" + Customer.strsType + "'"; } oledCmd = new OleDbCommand(strSecre, oledCon); oledDr = oledCmd.ExecuteReader(); return(oledDr); } catch (Exception ee) { return(oledDr);; } }// end fi
public int tbTelRecordAdd(tbTelRecordClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "insert into tb_TelRecord (fldTel,SearchDate,fldChannel,sFile,sType,fldMemo)"; strAdd += "values('" + Customer.strfldTel + "','" + Customer.daSearchDate + "','" + Customer.shfldChannel + "',"; strAdd += "'" + Customer.strsFile + "',"; strAdd += "'" + Customer.strsType + "','" + Customer.strfldMemo + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end fi
public void tbTelRecordAdd(string stringId, int intChannel) { tbTelRecordClass tbClass = new tbTelRecordClass(); tbTelRecordMenthod tbMenhod = new tbTelRecordMenthod(); tbCustomerMethod tbCustom = new tbCustomerMethod(); tbCustomerClass tbCuClass = new tbCustomerClass(); tbClass.strfldTel = stringId; tbClass.daSearchDate = DateTime.Now; tbClass.shfldChannel = intChannel; if (intLY == 1) { tbCuClass.kuTel = stringId; tbCuClass.kuOffice = stringId; int intFalgTel = DataGridFalg(tbCustom.tbCustomerSecarf(tbCuClass, "khTel"), DataGridViewCount(tbCustom.tbCustomerSecarf(tbCuClass, "khTel"))); tbClass.strsType = "打入"; } if (intLY == 0) { tbClass.strsType = "打出"; } tbMenhod.tbTelRecordAdd(tbClass); intLY = 0; }