📄 userinfoclass.cs
字号:
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
}
//**********************************************************************************
/// <summary>
/// 商品功能菜单导航
/// </summary>
/// <param name="dlName">商品类别信息</param>
public void DLClassBind(DataList dlName)
{
string P_Str_SqlStr = "select * from tb_Class";
SqlConnection myConn = dbObj.GetConnection();
SqlDataAdapter da = new SqlDataAdapter(P_Str_SqlStr, myConn);
DataSet ds = new DataSet();
da.Fill(ds, "Class");
dlName.DataSource = ds.Tables["Class"].DefaultView;
dlName.DataBind();
}
/// <summary>
/// 绑定商品信息(精品 热销商品 打折商品)
/// </summary>
/// <param name="P_Int_Deplay">(精品 热销商品 打折商品)三种类别的标志</param>
/// <param name="P_Str_srcTable">表信息</param>
/// <param name="DLName">绑定控件名</param>
public void DGIBind(int P_Int_Deplay, string P_Str_srcTable,DataList DLName)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_DeplayGInfo", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter Deplay = new SqlParameter("@Deplay", SqlDbType.Int, 4);
Deplay.Value = P_Int_Deplay;
myCmd.Parameters.Add(Deplay);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, P_Str_srcTable);
DLName.DataSource = ds.Tables[P_Str_srcTable].DefaultView;
DLName.DataBind();
}
/// <summary>
/// 以商品类别分类绑定商品信息
/// </summary>
/// <param name="P_Int_ClassID">商品类别编号</param>
/// <param name="P_Str_srcTable">表信息</param>
/// <param name="DLName">绑定控件名</param>
public void DCGIBind(int P_Int_ClassID, string P_Str_srcTable, DataList DLName)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_DeplayGIByC", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter ClassID = new SqlParameter("@ClassID", SqlDbType.BigInt, 8);
ClassID.Value = P_Int_ClassID;
myCmd.Parameters.Add(ClassID);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, P_Str_srcTable);
DLName.DataSource = ds.Tables[P_Str_srcTable].DefaultView;
DLName.DataBind();
}
//**************************购物车**********************************************************
/// <summary>
/// 向购物车中添加信息
/// </summary>
/// <param name="P_Int_GoodsID">商品编号</param>
/// <param name="P_Flt_MemberPrice">会员价格</param>
/// <param name="P_Int_MemberID">会员编号</param>
public void AddShopCart(int P_Int_GoodsID, float P_Flt_MemberPrice, int P_Int_MemberID, float P_Flt_GoodsWeight)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_InsertShopCart", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter GoodsID = new SqlParameter("@GoodsID", SqlDbType.BigInt, 8);
GoodsID.Value = P_Int_GoodsID;
myCmd.Parameters.Add(GoodsID);
//添加参数
SqlParameter MemberPrice = new SqlParameter("@MemberPrice", SqlDbType.Float, 8);
MemberPrice.Value = P_Flt_MemberPrice;
myCmd.Parameters.Add(MemberPrice);
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//添加参数
SqlParameter GoodsWeight = new SqlParameter("@GoodsWeight", SqlDbType.Float , 8);
GoodsWeight.Value = P_Flt_GoodsWeight;
myCmd.Parameters.Add(GoodsWeight);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
}
/// <summary>
/// 显示购物车中的信息
/// </summary>
/// <param name="P_Str_srcTable">信息表名</param>
/// <param name="gvName">控件名</param>
/// <param name="P_Int_MemberID">会员编号</param>
public void SCIBind(string P_Str_srcTable, GridView gvName, int P_Int_MemberID)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_GetShopCart", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, P_Str_srcTable);
gvName.DataSource = ds.Tables[P_Str_srcTable].DefaultView;
gvName.DataBind();
}
/// <summary>
/// 返回合计总数的Ds
/// </summary>
/// <param name="P_Str_srcTable">信息表名</param>
/// <param name="P_Int_MemberID">员工编号</param>
/// <returns>返回合计总数的Ds</returns>
public DataSet ReturnTotalDs(int P_Int_MemberID,string P_Str_srcTable)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_TotalInfo", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
SqlDataAdapter da = new SqlDataAdapter(myCmd);
DataSet ds = new DataSet();
da.Fill(ds, P_Str_srcTable);
return ds;
}
/// <summary>
/// 删除购物车中的信息
/// </summary>
/// <param name="P_Int_MemberID">会员编号</param>
public void DeleteShopCart(int P_Int_MemberID)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_DeleteShopCart", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
}
/// <summary>
/// 删除指定购物车中的信息
/// </summary>
/// <param name="P_Int_MemberID">会员编号</param>
/// <param name="P_Int_CartID">商品编号</param>
public void DeleteShopCartByID(int P_Int_MemberID,int P_Int_CartID)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_DeleteSCByID", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//添加参数
SqlParameter CartID = new SqlParameter("@CartID", SqlDbType.BigInt, 8);
CartID.Value = P_Int_CartID;
myCmd.Parameters.Add(CartID);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
}
}
/// <summary>
/// 当购物车中商品数量改变时,修改购物车中的信息
/// </summary>
/// <param name="P_Int_MemberID">会员ID号</param>
/// <param name="P_Int_CartID">商品编号</param>
/// <param name="P_Int_Num">商品数量</param>
public void UpdateSCI(int P_Int_MemberID, int P_Int_CartID, int P_Int_Num)
{
SqlConnection myConn = dbObj.GetConnection();
SqlCommand myCmd = new SqlCommand("Proc_UpdateSC", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
//添加参数
SqlParameter MemberID = new SqlParameter("@MemberID", SqlDbType.BigInt, 8);
MemberID.Value = P_Int_MemberID;
myCmd.Parameters.Add(MemberID);
//添加参数
SqlParameter CartID = new SqlParameter("@CartID", SqlDbType.BigInt, 8);
CartID.Value = P_Int_CartID;
myCmd.Parameters.Add(CartID);
//添加参数
SqlParameter Num = new SqlParameter("@Num", SqlDbType.BigInt, 8);
Num.Value = P_Int_Num;
myCmd.Parameters.Add(Num);
//执行过程
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw (ex);
}
finally
{
myCmd.Dispose();
myConn.Close();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -