UserInfoClass.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:11k
源码类别:
Email客户端
开发平台:
Visual C++
- /********************************************************************************
- ** 作者:ebDoing
- ** 创始时间: 2008-10-22
- ** 描述:
- ** 主要用于购物车的信息处理,…
- *********************************************************************************/
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- namespace ShopCart
- {
- /// <summary>
- /// UserInfoClass 的摘要说明
- /// </summary>
- public class UserInfoClass
- {
- DBClass dbObj = new DBClass();
- public UserInfoClass()
- {
- //
- // TODO: 在此处添加构造函数逻辑
- //
- }
- /// <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;
- }
- public string VarStr(string sString, int nLeng)
- {
- int index = sString.IndexOf(".");
- if (index == -1 || index + 2 >= sString.Length)
- return sString;
- else
- return sString.Substring(0, (index + nLeng + 1));
- }
- 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>
- /// 向购物车中添加信息
- /// </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_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();
- }
- }
- 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();
- }
- }
- }