Beispiel #1
0
        //根据账号类型ID得到账号类型信息
        public static userinfo getaccoutstypeinfo(int id)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@id", SqlDbType.Int);
            parms[0].Value = id;
            string        sql  = "select atid,accountstype,atdiscount from accountstype where atid=@id";
            userinfo      item = new userinfo();
            SqlDataReader dr   = null;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.atid         = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
                    item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
                    item.atdiscount   = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #2
0
        //得到网站内容类别列表
        public static List <websitetypeinfo> getwebsitetype()
        {
            string sql = "select wtid,websitetype from websitetype";
            List <websitetypeinfo> itlist = new List <websitetypeinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    websitetypeinfo item = new websitetypeinfo();
                    item.wtid        = TypeParse.DbObjToInt(dr["wtid"].ToString(), 0);
                    item.websitetype = TypeParse.DbObjToString(dr["websitetype"].ToString(), "");
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Beispiel #3
0
        /// <summary>
        /// 得到管理员ID
        /// </summary>
        /// <param name="adminname"></param>
        /// <returns></returns>
        public static int getAdminID(string adminname)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@adminname", SqlDbType.VarChar, 20);
            parms[0].Value = adminname;
            string        sql     = "select adminid FROM SysAdmin WHERE adminname=@adminname";
            SqlDataReader dr      = null;
            int           AdminID = 0;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    AdminID = TypeParse.DbObjToInt(dr["adminid"], 0);
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return(AdminID);
        }
Beispiel #4
0
        public static int getcartordernum(string cartid)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@cartid", SqlDbType.NVarChar, 50);
            parms[0].Value = cartid;


            string sql      = "select buynum from usercart where cartid=@cartid";
            int    ordernum = 1;

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    ordernum = TypeParse.DbObjToInt(dr["buynum"].ToString(), 1);
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(ordernum);
        }
Beispiel #5
0
        public static List <orderinfo> getphlist(string condition)
        {
            List <orderinfo> list = new List <orderinfo>();
            string           sql  = "select sum(usercart.buynum) as n,product.productcode,product.productimg,product.productname from usercart,userorder,product where usercart.ordernumber=userorder.ordernumber and usercart.productid=product.productid " + condition + " group by usercart.productid,product.productcode,product.productname,product.productimg";

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql).Tables[0];
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        orderinfo item = new orderinfo();
                        item.tjbuynum    = TypeParse.DbObjToInt(dr["n"].ToString(), 0);
                        item.productname = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                        item.productcode = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                        item.productimg  = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Beispiel #6
0
        /// <summary>
        /// 邮箱用户登录
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static bool emaillogin(userinfo data)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@email", SqlDbType.NVarChar, 20);
            parms[0].Value = data.email;
            parms[1]       = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[1].Value = data.MD5pwd;
            string sql = "if(EXISTS(SELECT userid FROM userinfo where email = @email and pwd=@pwd)) " +
                         "select 1 " +
                         "else " +
                         "select 0";


            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Beispiel #7
0
        //得到账号类型列表
        public static List <userinfo> getaccountstype()
        {
            string          sql    = "select atid,accountstype,atdiscount from accountstype";
            List <userinfo> itlist = new List <userinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    userinfo item = new userinfo();
                    item.atid         = TypeParse.DbObjToInt(dr["atid"].ToString(), 0);
                    item.accountstype = TypeParse.DbObjToString(dr["accountstype"].ToString(), "");
                    item.atdiscount   = Convert.ToDecimal(TypeParse.DbObjToString(dr["atdiscount"].ToString(), "1.00"));
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Beispiel #8
0
        /// <summary>
        /// 读取系统管理员信息
        /// </summary>
        /// <param name="adminid"></param>
        /// <returns></returns>
        public static admininfo getAdminInfo(int adminid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@adminid", SqlDbType.Int);
            parms[0].Value = adminid;

            admininfo data = new admininfo();
            string    sql  = "SELECT adminid,adminname,roleid,adddate,updatedate FROM SysAdmin WHERE  adminid=@adminid";

            try
            {
                SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (reader.Read())
                {
                    data.adminid    = TypeParse.DbObjToInt(reader["adminid"], 0);
                    data.adminname  = TypeParse.DbObjToString(reader["adminname"], "");
                    data.adddate    = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now);
                    data.updatedate = TypeParse.DbObjToDateTime(reader["updatedate"], DateTime.Now);
                    reader.Close();
                    reader.Dispose();
                }
                return(data);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
        }
Beispiel #9
0
        public static bool rlogin(userinfo item)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@pwd", SqlDbType.NVarChar, 50);
            parms[0].Value = item.MD5pwd;
            parms[1]       = new SqlParameter("@email", SqlDbType.NVarChar, 50);
            parms[1].Value = item.email;
            string sql = "if(EXISTS(SELECT [userid] FROM userinfo where [pwd] = @pwd and [email] = @email)) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Beispiel #10
0
        //根据大类别ID得到大类别信息
        public static categoryinfo getbigcategoryinfo(int id)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@id", SqlDbType.Int);
            parms[0].Value = id;
            string        sql  = "select bigcategoryid,bigcategory,bigcategoryimg from bigcategory where bigcategoryid=@id";
            categoryinfo  item = new categoryinfo();
            SqlDataReader dr   = null;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.bigcategoryid  = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory    = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    item.bigcategoryimg = TypeParse.DbObjToString(dr["bigcategoryimg"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #11
0
        //得到配送地址II类型列表通过Iid
        public static List <categoryinfo> getdeliveryIIbyID(int id)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@id", SqlDbType.Int);
            parms[0].Value = id;
            string sql = "select a.deliveryIIid,a.deliveryII,b.deliveryI,b.deliveryIid from deliveryII a,deliveryI b where a.deliveryIid=b.deliveryIid and a.deliveryIid=@id";
            List <categoryinfo> itlist = new List <categoryinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    categoryinfo item = new categoryinfo();
                    item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0);
                    item.deliveryII   = TypeParse.DbObjToString(dr["deliveryII"].ToString(), "");
                    item.deliveryIid  = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
                    item.deliveryI    = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Beispiel #12
0
        //通过大分类得到产品小类别
        public static List <categoryinfo> getsmallcategorybyid(int bigcategoryid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@bigcategoryid", SqlDbType.Int);
            parms[0].Value = bigcategoryid;

            string sql = "select a.smallcategoryid,a.smallcategory,a.bigcategoryid,b.bigcategory from smallcategory a,bigcategory b where a.bigcategoryid=b.bigcategoryid and b.bigcategoryid=@bigcategoryid";
            List <categoryinfo> itlist = new List <categoryinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    categoryinfo item = new categoryinfo();
                    item.smallcategoryid = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                    item.smallcategory   = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                    item.bigcategoryid   = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory     = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Beispiel #13
0
        //得到配送地址I类型列表
        public static List <categoryinfo> getdeliveryI()
        {
            string sql = "select deliveryIid,deliveryI from deliveryI";
            List <categoryinfo> itlist = new List <categoryinfo>();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    categoryinfo item = new categoryinfo();
                    item.deliveryIid = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
                    item.deliveryI   = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
                    itlist.Add(item);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(itlist);
        }
Beispiel #14
0
        /// <summary>
        /// 得到送货地址
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <addressinfo> getaddress(pageinfo pdata)
        {
            List <addressinfo> list = new List <addressinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        addressinfo item = new addressinfo();
                        item.addressid    = TypeParse.DbObjToInt(dr["addressid"].ToString(), 0);
                        item.address      = TypeParse.DbObjToString(dr["address"].ToString(), "");
                        item.contact      = TypeParse.DbObjToString(dr["contact"].ToString(), "");
                        item.mobile       = TypeParse.DbObjToString(dr["mobile"].ToString(), "");
                        item.tel          = TypeParse.DbObjToString(dr["tel"].ToString(), "");
                        item.userid       = TypeParse.DbObjToString(dr["userid"].ToString(), "");
                        item.deliveryIid  = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
                        item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0);
                        item.isdefault    = TypeParse.DbObjToInt(dr["isdefault"].ToString(), 0);
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Beispiel #15
0
        /// <summary>
        /// 根据ID读取资讯信息
        /// </summary>
        /// <param name="newsid"></param>
        /// <returns></returns>
        public static newsinfo getnewsinfo(string newsid)
        {
            string   sql  = "select news.newsid,news.newstitle,news.newswriter,news.newsfrom,news.newsnote,news.adddate,news.ntid,newstype.newstype,news.ninfo,news.istop,news.newsimg,news.userid from news,newstype where news.ntid=newstype.ntid and news.newsid=" + newsid + "";
            newsinfo item = new newsinfo();

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql);
                if (dr.Read())
                {
                    item.newsid     = TypeParse.DbObjToInt(dr["newsid"].ToString(), 0);
                    item.newstitle  = TypeParse.DbObjToString(dr["newstitle"].ToString(), "");
                    item.newswriter = TypeParse.DbObjToString(dr["newswriter"].ToString(), "");
                    item.ntid       = TypeParse.DbObjToInt(dr["ntid"].ToString(), 1);
                    item.istop      = TypeParse.DbObjToInt(dr["istop"].ToString(), 0);
                    item.newsfrom   = TypeParse.DbObjToString(dr["newsfrom"].ToString(), "");
                    item.newsnote   = TypeParse.DbObjToString(dr["newsnote"].ToString(), "");
                    item.ninfo      = TypeParse.DbObjToString(dr["ninfo"].ToString(), "");
                    item.newstype   = TypeParse.DbObjToString(dr["newstype"].ToString(), "");
                    item.adddate    = TypeParse.DbObjToDateTime(dr["adddate"].ToString(), DateTime.Now);
                    item.newsimg    = TypeParse.DbObjToString(dr["newsimg"].ToString(), "noimg.jpg");
                    item.userid     = TypeParse.DbObjToString(dr["userid"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #16
0
        public static bool CheckCart(string userid, int productid)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@userid", SqlDbType.NVarChar, 50);
            parms[0].Value = userid;
            parms[1]       = new SqlParameter("@productid", SqlDbType.Int);
            parms[1].Value = productid;
            string sql = "if(EXISTS(SELECT [cartid] FROM usercart where [userid] = @userid and [productid] =@productid and cartstate=0)) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Beispiel #17
0
        /// <summary>
        /// 得到管理员信息列表
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <admininfo> getAdminList()
        {
            List <admininfo> adminlist = new List <admininfo>();
            string           sql       = "SELECT adminid,adminname,roleid,adddate,updatedate FROM SysAdmin";

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql).Tables[0];
                if (dt != null)
                {
                    foreach (DataRow reader in dt.Rows)
                    {
                        admininfo data = new admininfo();
                        data.adminid    = TypeParse.DbObjToInt(reader["adminid"], 0);
                        data.adminname  = TypeParse.DbObjToString(reader["adminname"], "");
                        data.adddate    = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now);
                        data.updatedate = TypeParse.DbObjToDateTime(reader["updatedate"], DateTime.Now);
                        adminlist.Add(data);
                    }
                }

                return(adminlist);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
        }
Beispiel #18
0
        //根据配送地址II类型ID得到配送地址II类型信息
        public static categoryinfo getdeliveryIIinfo(int id)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@id", SqlDbType.Int);
            parms[0].Value = id;
            string        sql  = "select a.deliveryIIid,a.deliveryII,b.deliveryI,b.deliveryIid from deliveryII a,deliveryI b where a.deliveryIid=b.deliveryIid and a.deliveryIIid=@id";
            categoryinfo  item = new categoryinfo();
            SqlDataReader dr   = null;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.deliveryIIid = TypeParse.DbObjToInt(dr["deliveryIIid"].ToString(), 0);
                    item.deliveryII   = TypeParse.DbObjToString(dr["deliveryII"].ToString(), "");
                    item.deliveryIid  = TypeParse.DbObjToInt(dr["deliveryIid"].ToString(), 0);
                    item.deliveryI    = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #19
0
        public static List <admininfo> getAdminListPage(pageinfo item)
        {
            List <admininfo> adminlist = new List <admininfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(item);
                if (dt != null)
                {
                    foreach (DataRow reader in dt.Rows)
                    {
                        admininfo data = new admininfo();
                        data.adminid    = TypeParse.DbObjToInt(reader["adminid"], 0);
                        data.adminname  = TypeParse.DbObjToString(reader["adminname"], "");
                        data.adddate    = TypeParse.DbObjToDateTime(reader["adddate"], DateTime.Now);
                        data.updatedate = TypeParse.DbObjToDateTime(reader["updatedate"], DateTime.Now);
                        adminlist.Add(data);
                    }
                }

                return(adminlist);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
        }
Beispiel #20
0
        /// <summary>
        /// 昵称是否存在
        /// </summary>
        /// <param name="accounts"></param>
        /// <returns></returns>
        public static bool checkaccount(string accounts)
        {
            SqlParameter[] parms = new SqlParameter[2];
            parms[0]       = new SqlParameter("@accounts", SqlDbType.NVarChar, 50);
            parms[0].Value = accounts;

            string sql = "if(EXISTS(SELECT [userid] FROM userinfo where [accounts] = @accounts or [email]=@accounts )) " +
                         "select 1 " +
                         "else " +
                         "select 0";

            int result = 0;

            try
            {
                result = TypeParse.DbObjToInt(SqlHelper.ExecuteScalar(SqlHelper.connectionstring, CommandType.Text, sql, parms), 0);
            }
            catch (Exception E)
            {
                throw new Exception(E.Message);
            }
            finally
            { }
            return(result > 0);
        }
Beispiel #21
0
        public static int getcartcount(string uid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@userid", SqlDbType.NVarChar, 50);
            parms[0].Value = uid;

            string        sql = "select count(*) as n  FROM usercart where cartstate=0 and userid=@userid";
            SqlDataReader dr  = null;
            int           n   = 0;

            try
            {
                dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    n = TypeParse.DbObjToInt(dr["n"], 0);
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception E)
            {
                Console.Write(E.Message);
            }
            finally
            { }
            return(n);
        }
Beispiel #22
0
        //得到网站内容信息通过信息类别
        public static websitetypeinfo getwebsiteinfobytype(string type)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@type", SqlDbType.VarChar, 50);
            parms[0].Value = type;

            websitetypeinfo item = new websitetypeinfo();
            string          sql  = "select website.wsid,website.websitecontent, websitetype.websitetype from website,websitetype where website.wtid=websitetype.wtid AND websitetype.websitetype like'%" + type + "%'";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.wsid           = TypeParse.DbObjToInt(dr["wsid"].ToString(), 0);
                    item.websitecontent = TypeParse.DbObjToString(dr["websitecontent"].ToString(), "");
                    item.websitetype    = TypeParse.DbObjToString(dr["websitetype"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #23
0
        /// <summary>
        /// 根据图片类型名称得到单个广告图片信息
        /// </summary>
        /// <param name="imagestype"></param>
        /// <returns></returns>
        public static webimagesinfo getwebimagesinfoOne(string imagestype)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@imagestype", SqlDbType.VarChar, 50);
            parms[0].Value = imagestype;

            webimagesinfo item = new webimagesinfo();
            string        sql  = "SELECT top 1 webimages.wiid,webimages.imgurl,webimages.imginfo,webimages.itid,webimages.imgname,imagestype.imagestype FROM webimages,imagestype WHERE imagestype.imagestype=@imagestype AND webimages.itid=imagestype.itid order by webimages.wiid DESC";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.wiid       = TypeParse.DbObjToInt(dr["wiid"].ToString(), 0);
                    item.imgurl     = TypeParse.DbObjToString(dr["imgurl"].ToString(), "");
                    item.imginfo    = TypeParse.DbObjToString(dr["imginfo"].ToString(), "");
                    item.imgname    = TypeParse.DbObjToString(dr["imgname"].ToString(), "noimgs.jpg");
                    item.itid       = TypeParse.DbObjToInt(dr["itid"].ToString(), 0);
                    item.imagestype = TypeParse.DbObjToString(dr["imagestype"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #24
0
        //得到网站内容列表
        public static List <websitetypeinfo> getwebsite(pageinfo pdata)
        {
            List <websitetypeinfo> list = new List <websitetypeinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        websitetypeinfo item = new websitetypeinfo();
                        item.wsid           = TypeParse.DbObjToInt(dr["wsid"].ToString(), 0);
                        item.wtid           = TypeParse.DbObjToInt(dr["wtid"].ToString(), 0);
                        item.websitetype    = TypeParse.DbObjToString(dr["websitetype"].ToString(), "");
                        item.websitecontent = TypeParse.DbObjToString(dr["websitecontent"].ToString(), "");
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Beispiel #25
0
        /// <summary>
        /// 得到单个广告图片信息
        /// </summary>
        /// <param name="wiid"></param>
        /// <returns></returns>
        public static webimagesinfo getwebimagesinfo(int wiid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@wiid", SqlDbType.Int);
            parms[0].Value = wiid;

            webimagesinfo item = new webimagesinfo();
            string        sql  = "select webimages.wiid,webimages.imgurl,webimages.imginfo,webimages.itid,webimages.imgname,webimages.imgcor,imagestype.imagestype from webimages,imagestype where webimages.itid=imagestype.itid and webimages.wiid=@wiid";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.wiid       = TypeParse.DbObjToInt(dr["wiid"].ToString(), 0);
                    item.imgurl     = TypeParse.DbObjToString(dr["imgurl"].ToString(), "");
                    item.imginfo    = TypeParse.DbObjToString(dr["imginfo"].ToString(), "");
                    item.imgname    = TypeParse.DbObjToString(dr["imgname"].ToString(), "noimgs.jpg");
                    item.itid       = TypeParse.DbObjToInt(dr["itid"].ToString(), 0);
                    item.imagestype = TypeParse.DbObjToString(dr["imagestype"].ToString(), "");
                    item.imgcor     = TypeParse.DbObjToString(dr["imgcor"].ToString(), "");
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #26
0
        /// <summary>
        /// 得到广告图片
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <webimagesinfo> getwebimages(pageinfo pdata)
        {
            List <webimagesinfo> webimageslist = new List <webimagesinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        webimagesinfo item = new webimagesinfo();
                        item.wiid       = TypeParse.DbObjToInt(dr["wiid"].ToString(), 0);
                        item.imgurl     = TypeParse.DbObjToString(dr["imgurl"].ToString(), "");
                        item.imginfo    = TypeParse.DbObjToString(dr["imginfo"].ToString(), "");
                        item.imgname    = TypeParse.DbObjToString(dr["imgname"].ToString(), "noimgs.jpg");
                        item.itid       = TypeParse.DbObjToInt(dr["itid"].ToString(), 0);
                        item.imagestype = TypeParse.DbObjToString(dr["imagestype"].ToString(), "");
                        item.imgcor     = TypeParse.DbObjToString(dr["imgcor"].ToString(), "");
                        webimageslist.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(webimageslist);
        }
Beispiel #27
0
        /// <summary>
        /// 得到订单列表
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <orderinfo> getorderlist(pageinfo pdata)
        {
            List <orderinfo> list = new List <orderinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        orderinfo item = new orderinfo();
                        item.orderid      = TypeParse.DbObjToString(dr["orderid"].ToString(), "0");
                        item.tel          = TypeParse.DbObjToString(dr["tel"].ToString(), "");
                        item.mobile       = TypeParse.DbObjToString(dr["mobile"].ToString(), "");
                        item.address      = TypeParse.DbObjToString(dr["address"].ToString(), "");
                        item.contact      = TypeParse.DbObjToString(dr["contact"].ToString(), "");
                        item.allmoney     = Decimal.Parse(TypeParse.DbObjToString(dr["allmoney"].ToString(), "0.00"));
                        item.paymoney     = Decimal.Parse(TypeParse.DbObjToString(dr["paymoney"].ToString(), "0.00"));
                        item.orderstate   = TypeParse.DbObjToInt(dr["orderstate"].ToString(), 0);
                        item.orderdate    = TypeParse.DbObjToDateTime(dr["orderdate"].ToString(), DateTime.Now);
                        item.deliverydate = TypeParse.DbObjToDateTime(dr["deliverydate"].ToString(), DateTime.Now);
                        item.ordernumber  = TypeParse.DbObjToString(dr["ordernumber"].ToString(), "");
                        item.deliveryI    = TypeParse.DbObjToString(dr["deliveryI"].ToString(), "");
                        item.deliveryII   = TypeParse.DbObjToString(dr["deliveryII"].ToString(), "");
                        switch (item.orderstate)
                        {
                        case 0:
                            item.orderstatestr = "进行中";
                            break;

                        case 10:
                            item.orderstatestr = "已完成";
                            break;

                        case 44:
                            item.orderstatestr = "待处理";
                            break;

                        default:
                            item.orderstatestr = "进行中";
                            break;
                        }
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Beispiel #28
0
        //绑定浏览记录
        public static List <productinfo> bindproductlistvh(int n, string pidstr)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@pidstr", SqlDbType.NVarChar, 500);
            parms[0].Value = pidstr;

            List <productinfo> list = new List <productinfo>();
            string             sql  = "SELECT TOP " + n + " a.productid,a.productname,a.productprice,a.productcode,a.productbrief,a.productintroduce,a.vipprice,a.productimg,a.smallcategoryid,a.bigcategoryid,a.brand,a.punit,a.placeid,a.adddate,a.editdate,a.salestate,a.tjtypeid,b.bigcategory,c.smallcategory,d.place from product a ,bigcategory b ,smallcategory c ,place d where a.smallcategoryid=c.smallcategoryid and b.bigcategoryid=c.bigcategoryid and a.placeid=d.placeid  and a.productid in (" + pidstr + ")";

            try
            {
                DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.connectionstring, CommandType.Text, sql, parms).Tables[0];
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        productinfo item = new productinfo();
                        item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                        item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                        item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                        item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                        item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                        item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                        item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                        item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                        item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                        item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                        item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                        item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                        item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                        item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                        item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                        item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                        item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                        item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                        item.tjtypeid         = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }
Beispiel #29
0
        /// <summary>
        /// 得到单个产品信息
        /// </summary>
        /// <param name="wiid"></param>
        /// <returns></returns>
        public static productinfo getproductinfo(int productid)
        {
            SqlParameter[] parms = new SqlParameter[1];
            parms[0]       = new SqlParameter("@productid", SqlDbType.Int);
            parms[0].Value = productid;

            productinfo item = new productinfo();
            string      sql  = "select a.productid,a.productname,a.productprice,a.productcode,a.productbrief,a.productintroduce,a.vipprice,a.productimg,a.smallcategoryid,a.bigcategoryid,a.brand,a.punit,a.placeid,a.adddate,a.editdate,a.salestate,a.tjtypeid,b.bigcategory,c.smallcategory,d.place from product a ,bigcategory b ,smallcategory c ,place d where a.smallcategoryid=c.smallcategoryid and b.bigcategoryid=c.bigcategoryid and a.placeid=d.placeid and productid=@productid";

            try
            {
                SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.connectionstring, CommandType.Text, sql, parms);
                if (dr.Read())
                {
                    item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                    item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                    item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                    item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                    item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                    item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                    item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                    item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                    item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                    item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                    item.bigcategory      = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                    item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                    item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                    item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                    item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                    item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                    item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                    item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                    item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                    item.tjtypeid         = TypeParse.DbObjToInt(dr["tjtypeid"].ToString(), 0);
                    dr.Close();
                    dr.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(item);
        }
Beispiel #30
0
        /// <summary>
        /// 得到产品
        /// </summary>
        /// <param name="pdata"></param>
        /// <returns></returns>
        public static List <productinfo> getproduct(pageinfo pdata)
        {
            List <productinfo> list = new List <productinfo>();

            try
            {
                DataTable dt = pagehelper.getpagedt(pdata);
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        productinfo item = new productinfo();
                        item.productid        = TypeParse.DbObjToInt(dr["productid"].ToString(), 0);
                        item.productname      = TypeParse.DbObjToString(dr["productname"].ToString(), "");
                        item.vipprice         = Convert.ToDecimal(TypeParse.DbObjToString(dr["vipprice"].ToString(), "100.00"));
                        item.productprice     = Convert.ToDecimal(TypeParse.DbObjToString(dr["productprice"].ToString(), "100.00"));
                        item.productcode      = TypeParse.DbObjToString(dr["productcode"].ToString(), "");
                        item.productbrief     = TypeParse.DbObjToString(dr["productbrief"].ToString(), "");
                        item.productintroduce = TypeParse.DbObjToString(dr["productintroduce"].ToString(), "");
                        item.productimg       = TypeParse.DbObjToString(dr["productimg"].ToString(), "");
                        item.smallcategoryid  = TypeParse.DbObjToInt(dr["smallcategoryid"].ToString(), 0);
                        item.bigcategoryid    = TypeParse.DbObjToInt(dr["bigcategoryid"].ToString(), 0);
                        item.smallcategory    = TypeParse.DbObjToString(dr["smallcategory"].ToString(), "");
                        item.bigcategory      = TypeParse.DbObjToString(dr["bigcategory"].ToString(), "");
                        item.brand            = TypeParse.DbObjToString(dr["brand"].ToString(), "");
                        item.punit            = TypeParse.DbObjToString(dr["punit"].ToString(), "");
                        item.adddate          = TypeParse.DbObjToDateTime(dr["adddate"], DateTime.Now);
                        item.editdate         = TypeParse.DbObjToDateTime(dr["editdate"], DateTime.Now);
                        item.salestate        = TypeParse.DbObjToInt(dr["salestate"].ToString(), 0);
                        item.placeid          = TypeParse.DbObjToInt(dr["placeid"].ToString(), 0);
                        item.place            = TypeParse.DbObjToString(dr["place"].ToString(), "");
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
            }
            return(list);
        }