}// end if #endregion public int tbEmpSecarfInfo(tbEmployeeClass Customer) { string strSecarf = null; int intFalg = 0; try { tbDai = new tbDaiConnection(); //实例方法类 oledCon = tbDai.OledCon(); //打开数据库联接 strSecarf = "select * from tb_Employee where EmpEngish ='" + Customer.EmpEngish + "'"; oledCmd = new OleDbCommand(strSecarf, oledCon); //实例OleDbCommand对象 oledDr = oledCmd.ExecuteReader(); //调用方法 oledDr.Read(); if (oledDr.HasRows) { intFalg = 1; } oledDr.Close(); return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
}// end fi #endregion #region//登录信息 public int tbEmpLog(tbEmployeeClass Customer) { string strSecarf = null; int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); strSecarf = "select * from tb_Employee where EmpEngish='" + Customer.EmpEngish + "' and EmpPasword='" + Customer.EmpPasword + "'"; oledCmd = new OleDbCommand(strSecarf, oledCon); oledDr = oledCmd.ExecuteReader();// oledDr.Read(); if (oledDr.HasRows) { intFalg = 1; } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
}// end if #endregion #region//修改员工信息,返回值, 1表示成功,0表示失败 public int tbEmployeeUpdate(tbEmployeeClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); //实例一个联接数据库对象 oledCon = tbDai.OledCon(); //打开数据库 string strUpdate = "update tb_Employee set "; //创建添加字符串 strUpdate += "EmpName ='" + Customer.strEmpName + "',EmpNation= '" + Customer.shEmpNation + "',EmpEngish='" + Customer.EmpEngish + "',EmpPasword='" + Customer.EmpPasword + "',"; strUpdate += "EmpSex='" + Customer.shEmpSex + "',EmpIDcard='" + Customer.strEmpIDcard + "',fldEmpBirthday='" + Customer.strEmpSpecialty + "',EmpOfficeTel='" + Customer.strEmpOfficeTel + "',"; strUpdate += "EmpOICQ='" + Customer.strEmpOICQ + "',EmpEmail='" + Customer.strEmpEmail + "',EmpState='" + Customer.shEmpState + "',"; strUpdate += "EmpCity='" + Customer.shEmpCity + "',EmpWorkDate='" + Customer.EmpWorkDate + "',EmpDemissionDate='" + Customer.EmpDemissionDate + "',"; strUpdate += "fldEmpRemark='" + Customer.strfldEmpRemark + "',fldEmpWorkFlag='" + Customer.byfldEmpWorkFlag + "',EmpRegDate='" + Customer.EmpRegDate + "'"; strUpdate += " where EmployeeID='" + Customer.strEmployeeID + "'"; oledCmd = new OleDbCommand(strUpdate, oledCon); //实例OleDbCommand对象 if (oledCmd.ExecuteNonQuery() != 0) //调用方法执行添加操作,不等于0添加成功 { intFalg = 1; //修改成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }
}// end if #endregion #region //填冲客户编信息 TrreView控件 public void fillEmployee(object objTreeView, object obimage, OleDbDataReader dr) { try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); oledDr = dr; if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView") //判断参数类型 { System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage; //实例参数对象 System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView; //实例参数对象 TV.Nodes.Clear(); //清除节点数据 TV.ImageList = imlist; //调置控件属性 System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("员工编号", 0, 1); //添加根节点 while (oledDr.Read()) { TN.Nodes.Add("", oledDr[0].ToString(), 0, 1); //添加子节点 } TV.Nodes.Add(TN); oledDr.Close(); TV.ExpandAll();//展 } }// catch (Exception ee) { } }// end fi
}// 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
}// end if #endregion #region//查询员工信息,返回,OleDbDataReader对象 public OleDbDataReader tbEmpSecarf(tbEmployeeClass Customer) { string strSecarf = null; try { tbDai = new tbDaiConnection(); //实例方法类 oledCon = tbDai.OledCon(); //打开数据库联接 if (Customer.strEmployeeID != "") { strSecarf = "select * from tb_Employee where EmployeeID='" + Customer.strEmployeeID + "'"; } else { strSecarf = "select * from tb_Employee where fldEmpWorkFlag = false"; } oledCmd = new OleDbCommand(strSecarf, oledCon); //实例OleDbCommand对象 oledDr = oledCmd.ExecuteReader(); //调用方法 return(oledDr); } catch (Exception ee) { return(oledDr); } }// end if
}// end if #endregion #region //填冲客户编信息 TrreView控件 public void filltbProPath(object objTreeView, object obimage, OleDbDataReader dr) { try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); oledDr = dr; if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView") { System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage; System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView; TV.Nodes.Clear(); TV.ImageList = imlist; System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("客户编号", 0, 1); while (oledDr.Read()) { TN.Nodes.Add("", oledDr[0].ToString(), 0, 1); } TV.Nodes.Add(TN); oledDr.Close(); TV.ExpandAll(); } }// catch (Exception ee) { } }// end fi
}// end if #endregion #region//修改客户信息,返回值, 1表示成功,0表示失败 public int tbCustomerUpdate(tbCustomerClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strUpdate = "update tb_Customer set "; strUpdate += "khName ='" + Customer.khName + "',"; strUpdate += "khPi ='" + Customer.khPi + "',khType='" + Customer.khType + "',khHandye='" + Customer.khHandye + "',khState='" + Customer.khState + "',"; strUpdate += "khTel='" + Customer.kuTel + "',kuOffice='" + Customer.kuOffice + "',kuEmail='" + Customer.kuEmail + "',"; strUpdate += "kuAddress='" + Customer.kuAddress + "',kuChangPi='" + Customer.kuChangPi + "',kuSum='" + Customer.kuSum + "',"; strUpdate += "kuDate='" + Customer.kuDate + "',kuEmploy='" + Customer.kuEmploy + "',kuDateLaste='" + Customer.kuDateLaste + "',kuFalg='" + Customer.kuFalg + "'"; strUpdate += " where khID='" + Customer.khID + "'"; oledCmd = new OleDbCommand(strUpdate, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
public int tbEmployeeAdd(tbEmployeeClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); //实例一个联接数据库对象 oledCon = tbDai.OledCon(); //打开数据库 string strAdd = "insert into tb_Employee "; //创建添加字符串 strAdd += "values('" + Customer.strEmployeeID + "','" + Customer.strEmpName + "','" + Customer.EmpEngish + "','" + Customer.EmpPasword + "','" + Customer.shEmpNation + "',"; strAdd += "'" + Customer.shEmpSex + "','" + Customer.strEmpIDcard + "','" + Customer.strEmpSpecialty + "','" + Customer.strEmpOfficeTel + "',"; strAdd += "'" + Customer.strEmpOICQ + "','" + Customer.strEmpEmail + "','" + Customer.shEmpState + "',"; strAdd += "'" + Customer.shEmpCity + "','" + Customer.EmpWorkDate + "','" + Customer.EmpDemissionDate + "',"; strAdd += "'" + Customer.strfldEmpRemark + "','" + Customer.byfldEmpWorkFlag + "','" + Customer.EmpRegDate + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); //实例OleDbCommand对象 if (oledCmd.ExecuteNonQuery() != 0) //调用方法执行添加操作,不等于0添加成功 { intFalg = 1; //添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
}// end fi #endregion #region //查询电话记录返回 一个 DataSet 对象 public DataSet tbTelRecordSet(string Customer) { string strSescf = null; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); if (Customer != "") { strSescf = "select * from tb_TelRecord where like '" + Customer + "%'"; } else { strSescf = "select * from tb_TelRecord"; } oledDDa = new OleDbDataAdapter(strSescf, oledCon); ds = new DataSet(); oledDDa.Fill(ds, "tbTelRecord"); return(ds); } catch (Exception ee) { return(ds); } }// end fi
}// end fi #endregion #region //填冲商品类别信息 TrreView控件 public void filltbProPath(object objTreeView, object obimage) { try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "select * from tb_ProPath where ProPath='" + 0 + "'"; oledCmd = new OleDbCommand(strAdd, oledCon); oledDr = oledCmd.ExecuteReader(); if (objTreeView.GetType().ToString() == "System.Windows.Forms.TreeView") { System.Windows.Forms.ImageList imlist = (System.Windows.Forms.ImageList)obimage; System.Windows.Forms.TreeView TV = (System.Windows.Forms.TreeView)objTreeView; TV.Nodes.Clear(); TV.ImageList = imlist; System.Windows.Forms.TreeNode TN = new System.Windows.Forms.TreeNode("商品分类", 0, 1); while (oledDr.Read()) { TN.Nodes.Add("", oledDr[1].ToString(), 0, 1); } TV.Nodes.Add(TN); oledDr.Close(); TV.ExpandAll(); } }// catch (Exception ee) { } }// end fi
}// end if #endregion #region//修改产品信息,返回值, 1表示成功,0表示失败 public int tbProductionUpdate(tbProductionClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "update tb_Production set "; strAdd += "ProName='" + Customer.strProName + "',SellPrice='" + Customer.dePrice + "',ProPath='" + Customer.strProPath + "',"; strAdd += "ProManufacturer='" + Customer.strProManufacturer + "',ProPOV='" + Customer.intProPOV + "',ProExplain ='" + Customer.strProExplain + "',"; strAdd += "ProRegDate='" + Customer.daProRegDate + "',ProOperator='" + Customer.strProOperator + "',"; strAdd += "ProMemo='" + Customer.strProMemo + "',ProFalg='" + Customer.ProFalg + "' where ProNo='" + Customer.strProNo + "'"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
public int tbProductionAdd(tbProductionClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "insert into tb_Production "; strAdd += "values('" + Customer.strProNo + "','" + Customer.strProName + "','" + Customer.dePrice + "','" + Customer.strProPath + "',"; strAdd += "'" + Customer.strProManufacturer + "','" + Customer.intProPOV + "','" + Customer.strProExplain + "',"; strAdd += "'" + Customer.daProRegDate + "','" + Customer.strProOperator + "',"; strAdd += "'" + Customer.strProMemo + "','" + Customer.ProFalg + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
public int tbCustomerAdd(tbCustomerClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "insert into tb_Customer "; strAdd += "values('" + Customer.khID + "','" + Customer.khName + "',"; strAdd += "'" + Customer.khPi + "','" + Customer.khType + "','" + Customer.khHandye + "','" + Customer.khState + "',"; strAdd += "'" + Customer.kuTel + "','" + Customer.kuOffice + "','" + Customer.kuEmail + "',"; strAdd += "'" + Customer.kuAddress + "','" + Customer.kuChangPi + "','" + Customer.kuSum + "',"; strAdd += "'" + Customer.kuDate + "','" + Customer.kuEmploy + "','" + Customer.kuDateLaste + "','" + Customer.kuFalg + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
public void filltb_Marital(object comb) { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); oledDDa = new OleDbDataAdapter("select LCaption from tb_Marital ", oledCon); ds = new DataSet(); oledDDa.Fill(ds); if (comb.GetType().ToString() == "System.Windows.Forms.ComboBox") { System.Windows.Forms.ComboBox cmb = (System.Windows.Forms.ComboBox)comb; cmb.DataSource = ds.Tables[0].DefaultView; cmb.DisplayMember = "LCaption"; } oledCon.Close(); }
}// end fi #endregion #region //查询商品类别信息 成功返回1,失败返回0 public OleDbDataReader tbProPathSearch() { try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "select * from tb_ProPath where ProPath='" + 0 + "'"; oledCmd = new OleDbCommand(strAdd, oledCon); oledDr = oledCmd.ExecuteReader(); return(oledDr); } catch (Exception ee) { return(oledDr); } }// end fi
}// end if #endregion #region//查询产品信息,返回,OleDbDataReader对象 public OleDbDataReader tbProductionSecarf(tbProductionClass Customer) { string strSecarf = null; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); strSecarf = "select * from tb_Production where ProNo='" + Customer.strProNo + "'"; oledCmd = new OleDbCommand(strSecarf, oledCon); oledDr = oledCmd.ExecuteReader();// return(oledDr); } catch (Exception ee) { return(oledDr); } }// end if
public int tbProPathMenthodAdd(tbProPathClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "insert into tb_ProPath "; strAdd += "values('" + Customer.ProID + "','" + Customer.ProName + "','" + Customer.ProPath + "')"; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end fi
}// end if #endregion #region //删除商品类别信息 成功返回1,失败返回0 public int tbProPathUpdate(tbProPathClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strAdd = "update tb_ProPath set "; strAdd += "ProPath='" + Customer.ProPath + "' where ProID='" + Customer.ProID + "' "; oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end fi
public int tbEmployeeDelete(tbEmployeeClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); //实例一个联接数据库对象 oledCon = tbDai.OledCon(); //联接数据库 string strUpdate = "update tb_Employee set "; //创建删除字符串 strUpdate += "fldEmpWorkFlag='" + Customer.byfldEmpWorkFlag + "'"; strUpdate += " where EmployeeID='" + Customer.strEmployeeID + "'"; oledCmd = new OleDbCommand(strUpdate, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
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
}// end if #endregion #region//删除客户信息,返回值, 1表示成功,0表示失败,将客户删除标记修改为1 public int tbCustomerDelete(tbCustomerClass Customer) { int intFalg = 0; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); string strUpdate = "update tb_Customer set "; strUpdate += "kuFalg='" + Customer.kuFalg + "'"; strUpdate += " where khID='" + Customer.khID + "'"; oledCmd = new OleDbCommand(strUpdate, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }// end if
}// end if #endregion #region//查询客户信息,返回,OleDbDataReader对象 public OleDbDataReader tbCustomerSecarf(tbCustomerClass Customer, string strFalg) { string strSecarf = null; try { tbDai = new tbDaiConnection(); oledCon = tbDai.OledCon(); switch (strFalg) { case "khID": //客户ID strSecarf = "select * from tb_Customer where khID='" + Customer.khID + "'"; break; case "LikekhID": //客户ID if (Customer.khID == "") { strSecarf = "select * from tb_Customer where kuFalg= 0"; } else { strSecarf = "select * from tb_Customer where khID like '%" + Customer.khID + "%' and kuFalg= 0"; } break; case "khName": //客户姓名 strSecarf = "select * from tb_Customer where khPi='" + Customer.khPi + "' and kuFalg= 0"; break; case "LikekhName": //客户姓名 if (Customer.khPi != "") { strSecarf = "select * from tb_Customer where khPi like'%" + Customer.khPi + "%' and kuFalg= 0"; } else { strSecarf = "select * from tb_Customer where kuFalg= 0"; } // "select * from tb_TelSend where TelContent like '%" + textBox1.Text + "%'"; break; case "kuComputy": //公司姓名 strSecarf = "select * from tb_Customer where khName='" + Customer.khName + "'and kuFalg= 0 "; break; case "kuComputylike": //公司姓名 if (Customer.khName != "") { strSecarf = "select * from tb_Customer where khName like'%" + Customer.khName + "%' and kuFalg= 0"; } else { strSecarf = "select * from tb_Customer where kuFalg= 0"; } break; case "khTel": //电话查询 strSecarf = "select * from tb_Customer where khTel='" + Customer.kuTel + "' or kuOffice='" + Customer.kuOffice + "'"; break; case "khTelLike": //电话查询 if (Customer.kuTel != "" || Customer.kuOffice != "") { strSecarf = "select * from tb_Customer where khTel like '%" + Customer.kuTel + "%' or kuOffice like '%" + Customer.kuOffice + "%'"; } else { strSecarf = "select * from tb_Customer where kuFalg= 0"; } break; } oledCmd = new OleDbCommand(strSecarf, oledCon); oledDr = oledCmd.ExecuteReader();// return(oledDr); } catch (Exception ee) { return(oledDr); } }// end if