(完整版)小型超市收银系统的设计与实现毕业设计论文 下载本文

{

this.msqlCon = new SqlConnection(mstrCon);

SqlCommand myCmd = new SqlCommand(\msqlCon);

myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数

SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);

myID.Value = tempGoodsID; myCmd.Parameters.Add(myID); 执行存储过程 try {

msqlCon.Open();

myCmd.ExecuteNonQuery(); return true; } catch {

return false; } finally {

msqlCon.Close(); }

}

判断是否存在商品

public bool HasGoods(string tempGoodsID) {

this.msqlCon = new SqlConnection(mstrCon);

SqlCommand myCmd = new SqlCommand(\msqlCon);

myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数

SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);

myID.Value = tempGoodsID; myCmd.Parameters.Add(myID);

SqlParameter flag = new SqlParameter(\ParameterDirection.Output;

myCmd.Parameters.Add(flag); try {

msqlCon.Open();

myCmd.ExecuteNonQuery();

return (Convert.ToBoolean(flag.Value)); } catch {

return false; } finally {

msqlCon.Close(); } }

判断某供应商是否提供某商品

public bool IsSupplyGds(string tempCmp,string tempGoodsID) {

this.msqlCon = new SqlConnection(mstrCon);

SqlCommand myCmd = new SqlCommand(\msqlCon);

myCmdmandType = CommandType.StoredProcedure; 给存储过程添加参数

SqlParameter myID = new SqlParameter(\SqlDbType.NVarChar, 20);

myID.Value = tempGoodsID; myCmd.Parameters.Add(myID);

SqlParameter myCmp=new

SqlParameter(\ myCmp.Value=tempCmp; myCmd.Parameters.Add(myCmp);

SqlParameter myflag=new SqlParameter(\

myflag.Direction = ParameterDirection.Output; myCmd.Parameters.Add(myflag); 执行存储过程 try {

msqlCon.Open();

myCmd.ExecuteNonQuery();

return Convert.ToBoolean(myflag.Value); } catch {

return false; } finally {

msqlCon.Close(); } } 增加库存

public bool AddStock(string tempStockID,string

tempGoodsID,string tempCmp,string tempOperator,float tempPrice,int tempNum,string tempRemark,int tempflag) {