//删除联系人 public void DeletePerson() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "delete TXL_Persons from TXL_Persons where PersonID=" + _personID + ""; myObj.ExecuteSqlStr();//删除数据 }
//删除分组 public void Delete() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "delete from TXL_Cats where CatName='" + _catName.ToString() + "' and UserID=" + _userID + ""; myObj.ExecuteSqlStr();//删除记录 }
//编辑分组名称 public void Update() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "update TXL_Cats set catname='" + _catName + "' where UserID=" + _userID + " and CatId=" + _catId + ""; myObj.ExecuteSqlStr();//删除记录 }
//添加分组 public void Add() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "insert into TXL_Cats (UserID,catname) values(" + _userID + ",'" + _catName + "') "; myObj.ExecuteSqlStr();//确认插入数据 }
//返回所有记录的dataset public DataSet GetAllTXLCatsDS() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats where UserID=" + _userID + " order by catname asc"; return(myObj.ExecuteSqlStrReturnDs()); }
//由PersonId的到其他字段值 public OleDbDataReader GetAllPerson() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Persons where PersonId=" + _personId + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); return(myReader); }
//返回所有记录的datareader public OleDbDataReader GetAllTXLCatsDR(int catId) { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Persons where catId=" + catId.ToString() + " order by PersonName asc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return(myReader); }
//返回所有Cats记录的datareader public OleDbDataReader GetAllTXLCatsDR() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats where UserID=" + _userID + " order by catname asc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return(myReader); }
//获取账号ID public int UserId() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select UserID from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) return int.Parse(myReader["UserID"].ToString()); else return -1; }
//得到person的id public OleDbDataReader GetPersonID() { AccessDB myObj = new AccessDB(); //myObj.SqlStr = "select PersonID from TXL_Persons where PersonName='" + _name + "'and PersonTel='" + _tel + "'and PersonQQ='" + _qq + "'and CatId=" + _catId + " and UserID=" + _userID + ""; myObj.SqlStr = "select PersonID from TXL_Persons where PersonName='" + _name + "' and CatId=" + _catId + " and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return(myReader); }
//根据账号检测安全问题 //public ArrayList GetQuestion() //{ // ArrayList tmpList = new ArrayList(); // AccessDB myObj = new AccessDB(); // myObj.SqlStr = "select Question from TXL_Safe where UserName='******'"; // OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 // while (myReader.Read()) // { // tmpList.Add(myReader["Question"].ToString()); // } // myReader.Close(); // return tmpList; //} public string GetQuestion() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Safe where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) return myReader["Question"].ToString(); else return "账号不存在"; }
//单条记录 public void GetModel() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats where catid='" + _catId.ToString() + "' and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) { _catName = myReader["catname"].ToString(); } myReader.Close(); }
public bool login() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Users where UserName='******' and Pass='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) { return true; } else { return false; } }
//检测账号是否存在 public bool exit() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select UserName from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return true; } else { return false; } }
//显示密码 public string Keys() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select Pass from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return myReader["Pass"].ToString(); } else { return "未知错误!"; } }
//返回所有分类//增加了集合的操作/集合copyto array public ArrayList GetAllTXLCats() { ArrayList tmpList = new ArrayList(); AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats order by catname asc where UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 while (myReader.Read()) { tmpList.Add(myReader["catname"].ToString()); } myReader.Close(); return(tmpList); }
//得到最大的ID号 public int GetMAXId() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select top 1 catid from TXL_Cats where UserID=" + _userID + " order by catid desc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) { return(int.Parse(myReader["catid"].ToString())); } else { return(-1); } }
//根据账号检测安全问题 //public ArrayList GetQuestion() //{ // ArrayList tmpList = new ArrayList(); // AccessDB myObj = new AccessDB(); // myObj.SqlStr = "select Question from TXL_Safe where UserName='******'"; // OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 // while (myReader.Read()) // { // tmpList.Add(myReader["Question"].ToString()); // } // myReader.Close(); // return tmpList; //} public string GetQuestion() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Safe where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) { return(myReader["Question"].ToString()); } else { return("账号不存在"); } }
//由CatId得到CatName的值 public string GetCatName() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select CatName from TXL_Cats where CatId=" + _catId + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return(myReader["CatName"].ToString()); } else { return(null); } }
public bool login() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Users where UserName='******' and Pass='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) { return(true); } else { return(false); } }
//检测账号是否存在 public bool exit() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select UserName from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return(true); } else { return(false); } }
//获取账号ID public int UserId() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select UserID from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return(int.Parse(myReader["UserID"].ToString())); } else { return(-1); } }
//显示密码 public string Keys() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select Pass from TXL_Users where UserName='******'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return(myReader["Pass"].ToString()); } else { return("未知错误!"); } }
//查询分组ID public int CatIds() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select CatId from TXL_Cats where CatName='" + _catName + "' and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return(int.Parse(myReader["CatId"].ToString())); } else { return(-1); } }
//搜索联系人 public OleDbDataReader Search() { AccessDB myObj = new AccessDB(); //以下查询没实现··· myObj.SqlStr = "select * from TXL_Persons where ((PersonName like '" + _personName + "*' and PersonTel like '" + _tel + "*' and PersonCel like '" + _personCel + "*') " + "or(PersonName like '" + _personName + "*' and PersonTel like '" + _tel + "*' and PersonCel is null)" + "or(PersonName like '" + _personName + "*'and PersonTel is null and PersonCel like '" + _personCel + "*')" + "or(PersonName is null and PersonTel like '" + _tel + "*' and PersonCel like '" + _personCel + "*')" + "or(PersonName like '" + _personName + "*' and PersonTel is null and PersonCel is null) " + "or(PersonName is null and PersonTel like '" + _tel + "*' and PersonCel is null)" + "or(PersonName is null and PersonTel is null and PersonCel like '" + _personCel + "*'))" + "and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); return(myReader); }
//找回密码 public bool safe() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select count(*) from TXL_Safe where UserName='******' and Question='" + _question + "' and Answer='" + _answer + "'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { if (myReader[0].ToString() == "1") { return(true); } else { return(false); } } else { return(false); } }
//查询分组ID public int CatIds() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select CatId from TXL_Cats where CatName='" + _catName + "' and UserID="+_userID+""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return int.Parse(myReader["CatId"].ToString()); } else { return -1; } }
//得到person的id public OleDbDataReader GetPersonID() { AccessDB myObj = new AccessDB(); //myObj.SqlStr = "select PersonID from TXL_Persons where PersonName='" + _name + "'and PersonTel='" + _tel + "'and PersonQQ='" + _qq + "'and CatId=" + _catId + " and UserID=" + _userID + ""; myObj.SqlStr = "select PersonID from TXL_Persons where PersonName='" + _name + "' and CatId=" + _catId + " and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return myReader; }
//编辑分组名称 public void Update() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "update TXL_Cats set catname='" + _catName + "' where UserID=" + _userID + " and CatId="+_catId+""; myObj.ExecuteSqlStr();//删除记录 }
//得到最大的ID号 public int GetMAXId() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select top 1 catid from TXL_Cats where UserID=" + _userID + " order by catid desc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 if (myReader.Read()) return int.Parse(myReader["catid"].ToString()); else return -1; }
//返回所有Cats记录的datareader public OleDbDataReader GetAllTXLCatsDR() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats where UserID=" + _userID + " order by catname asc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return myReader; }
//注册账号 public void Add() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "insert into TXL_Safe (UserName,Question,Answer) values('" + _userName + "','" + _question + "','" + _answer + "') "; myObj.ExecuteSqlStr();//确认插入数据 }
//返回所有记录的datareader public OleDbDataReader GetAllCONNDTDR(int ndt_id) { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from CONSIGN_ndt where ndt_id=" + ndt_id.ToString() + " order by ndt_name asc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return myReader; }
//搜索联系人 public OleDbDataReader Search() { AccessDB myObj = new AccessDB(); //以下查询没实现··· myObj.SqlStr = "select * from TXL_Persons where ((PersonName like '" + _personName + "*' and PersonTel like '" + _tel + "*' and PersonCel like '" + _personCel + "*') " + "or(PersonName like '" + _personName + "*' and PersonTel like '" + _tel + "*' and PersonCel is null)" + "or(PersonName like '" + _personName + "*'and PersonTel is null and PersonCel like '" + _personCel + "*')" + "or(PersonName is null and PersonTel like '" + _tel + "*' and PersonCel like '" + _personCel + "*')" + "or(PersonName like '" + _personName + "*' and PersonTel is null and PersonCel is null) " + "or(PersonName is null and PersonTel like '" + _tel + "*' and PersonCel is null)" + "or(PersonName is null and PersonTel is null and PersonCel like '" + _personCel + "*'))" + "and UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); return myReader; }
//由con_id的到其他字段值 public OleDbDataReader GetAllconndt() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from CONSIGN_ndt where ndt_id=" + _ndt_id + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); return myReader; }
//修改ndt委托 public void Changndt() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "update [CONSIGN_ndt] set ndt_no='" + _ndt_no + "',ndt_wtrq='" + _ndt_wtrq + "',ndt_sjdw='" + _ndt_sjdw + "',ndt_wtr='" + _ndt_wtr + "',ndt_sjdwdz='" + _ndt_sjdwdz + "',ndt_tel='" + _ndt_tel + "',ndt_name='" + _ndt_name + "',ndt_jsdw='" + _ndt_jsdw + "',ndt_gcbh='" + _ndt_gcbh + "',ndt_fgcmc='" + _ndt_fgcmc + "',ndt_fgcbh='" + _ndt_fgcbh + "',ndt_gclb='" + _ndt_gclb + "',ndt_jjlx='" + _ndt_jjlx + "',ndt_jjgg='" + _ndt_jjgg + "',ndt_jjjb='" + _ndt_jjjb + "',ndt_cz='" + _ndt_cz + "',ndt_jcsj='" + _ndt_jcsj + "',ndt_hflx='" + _ndt_hflx + "',ndt_hjfs='" + _ndt_hjfs + "',ndt_pkxs='" + _ndt_pkxs + "',ndt_bmzl='" + _ndt_bmzl + "',ndt_jjcs='" + _ndt_jjcs + "',ndt_zjy='" + _ndt_zjy + "',ndt_jcxm='" + _ndt_jcxm + "',ndt_jcbz='" + _ndt_jcbz + "',ndt_hejb='" + _ndt_hejb + "',ndt_jcbi='" + _ndt_jcbi + "',ndt_jcsl='" + _ndt_jcsl + "',ndt_wcrq='" + _ndt_wcrq + "',ndt_sm='" + _ndt_sm + "',ndt_jsr='" + _ndt_jsr + "',ndt_jsrq='" + _ndt_jsrq + "' where ndt_id=" + _ndt_id + ""; myObj.ExecuteSqlStr(); }
//添加联系人 public void AddPersons() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "insert into TXL_Persons (UserID,PersonName,PersonTel,PersonCel,PersonAddress,PersonQQ,CatId,Remark) values(" + _userID + ",'" + _name + "','" + _tel + "','"+_personCel+"','"+_address+"','" + _qq + "','" + _catId + "','"+_remark+"')"; myObj.ExecuteSqlStr();//确认插入数据 }
//添加NDT委托 public void Addcon_ndt() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "insert into CONSIGN_ndt (UserID,ndt_no,ndt_wtrq,ndt_sjdw,ndt_wtr,ndt_sjdwdz,ndt_tel,ndt_name,ndt_jsdw,ndt_gcbh,ndt_fgcmc,ndt_fgcbh,ndt_gclb,ndt_jjlx,ndt_jjgg,ndt_jjjb,ndt_cz,ndt_jcsj,ndt_hflx,ndt_hjfs,ndt_pkxs,ndt_bmzl,ndt_jjcs,ndt_zjy,ndt_jcxm,ndt_jcbz,ndt_hejb,ndt_jcbi,ndt_jcsl,ndt_wcrq,ndt_sm,ndt_jsr,ndt_jsrq) values(" + 10 + ",'" + _ndt_no + "','" + _ndt_wtrq + "','" + _ndt_sjdw + "','" + _ndt_wtr + "','" + _ndt_sjdwdz + "','" + _ndt_tel + "','" + _ndt_name + "','" + _ndt_jsdw + "','" + _ndt_gcbh + "','" + _ndt_fgcmc + "','" + _ndt_fgcbh + "','" + _ndt_gclb + "','" + _ndt_jjlx + "','" + _ndt_jjgg + "','" + _ndt_jjjb + "','" + _ndt_cz + "','" + _ndt_jcsj + "','" + _ndt_hflx + "','" + _ndt_hjfs + "','" + _ndt_pkxs + "','" + _ndt_bmzl + "','" + _ndt_jjcs + "','" + _ndt_zjy + "','" + _ndt_jcxm + "','" + _ndt_jcbz + "','" + _ndt_hejb + "','" + _ndt_jcbi + "','" + _ndt_jcsl + "','" + _ndt_wcrq + "','" + _ndt_sm + "','" + _ndt_jsr + "','" + _ndt_jsrq + "')"; myObj.ExecuteSqlStr();//确认插入数据 }
//返回所有记录的dataset public DataSet GetAllTXLCatsDS() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats where UserID=" + _userID + " order by catname asc"; return myObj.ExecuteSqlStrReturnDs(); }
//添加工程编号 public void Addndtno() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "insert into CONSIGN_ndt (UserID,ndt_no) values(" + _UserID + ",'" + _ndt_no + "') "; myObj.ExecuteSqlStr();//确认插入数据 }
//查询ndt的ID public int ndtid() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select ndt_id from CONSIGN_ndt where ndt_no='" + _ndt_no + "' and UserID=" + _UserID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return int.Parse(myReader["ndt_id"].ToString()); } else { return -1; } }
//删除工程 public void Deletendt() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "delete from CONSIGN_ndt where ndt_no='" + _ndt_no + "' and UserID=" + _UserID + ""; myObj.ExecuteSqlStr();//删除记录 }
//返回所有ndt记录的datareader public OleDbDataReader GetAllCONNDTDR() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from CONSIGN_ndt where UserID=" + _UserID + " order by ndt_no asc"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 return myReader; }
//由ndt_Id得到ndt_no的值 public string Getndtno() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select ndt_no from CONSIGN_ndt where ndt_id=" + _ndt_id + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { return myReader["ndt_no"].ToString(); } else { return null; } }
//返回所有分类//增加了集合的操作/集合copyto array public ArrayList GetAllTXLCats() { ArrayList tmpList = new ArrayList(); AccessDB myObj = new AccessDB(); myObj.SqlStr = "select * from TXL_Cats order by catname asc where UserID=" + _userID + ""; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr();//返回记录集 while (myReader.Read()) { tmpList.Add(myReader["catname"].ToString()); } myReader.Close(); return tmpList; }
//编辑工程编号 public void Updatendtno() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "update CONSIGN_ndt set ndt_no='" + _ndt_no + "' where UserID=" + _UserID + " and ndt_id=" + _ndt_id + ""; myObj.ExecuteSqlStr();//删除记录 }
//找回密码 public bool safe() { AccessDB myObj = new AccessDB(); myObj.SqlStr = "select count(*) from TXL_Safe where UserName='******' and Question='" + _question + "' and Answer='" + _answer + "'"; OleDbDataReader myReader = myObj.ExecuteSqlStrReturnDr(); if (myReader.Read()) { if (myReader[0].ToString() == "1") return true; else return false; } else { return false; } }