⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userinfoclass.cs

📁 天织在线购物网站完整源码及文档 本网站是一套基于Web2.0思想设计、采用asp.net2.0开发的社区门户产品。它同时也是一套Web2.0全面解决方案
💻 CS
字号:
/********************************************************************************
** 作者:高亮
** 创始时间: 2007-12-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();

        }
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -