public List <Model.CommodityType> GetCommodityType()
        {
            List <Model.CommodityType> books = new List <Model.CommodityType>();
            CommodityType book = null;

            if (DBHerpel.OpenConnection())
            {
                SqlDataReader dr = DBHerpel.ExecReader("select * from CommodityType where State=0");

                if (dr != null)
                {
                    while (dr.Read())
                    {
                        book = new CommodityType();
                        book.CommodityTypeID   = (int)dr["CommodityTypeID"];
                        book.CommodityTypeName = dr["CommodityTypeName"] as string;
                        book.State             = (int)dr["State"];
                        books.Add(book);
                    }
                }

                DBHerpel.CloseConnection();
            }

            return(books);
        }
Beispiel #2
0
        /// <summary>
        /// 修改用户信息
        /// </summary>
        /// <param name="cu"></param>
        /// <returns></returns>
        public int updatecustomer(customer cu)
        {
            string sql = "update customer set State=0";

            if (!string.IsNullOrEmpty(cu.Pssword))
            {
                sql += ",[Password]='" + cu.Pssword + "'";
            }

            if (!string.IsNullOrEmpty(cu.Name))
            {
                sql += ",Name='" + cu.Name + "'";
            }

            if (!string.IsNullOrEmpty(cu.Phone))
            {
                sql += ",Phone='" + cu.Phone + "'";
            }

            if (!string.IsNullOrEmpty(cu.Email))
            {
                sql += ",Email='" + cu.Email + "'";
            }

            if (!string.IsNullOrEmpty(cu.Adress))
            {
                sql += ",Adress='" + cu.Adress + "'";
            }

            sql += " where ID=" + cu.ID;

            return(DBHerpel.ExecQuery(sql));
        }
Beispiel #3
0
        /// <summary>
        /// 查询学生信息
        /// </summary>
        /// <param name="cu">学生信息</param>
        /// <returns></returns>
        public List <customer> selcustomer(string where)
        {
            List <Model.customer> cus = new List <Model.customer>();
            customer sut = null;

            if (DBHerpel.OpenConnection())
            {
                SqlDataReader dr = DBHerpel.ExecReader("select * from customer where State=0 " + where);

                if (dr != null)
                {
                    while (dr.Read())
                    {
                        sut              = new customer();
                        sut.ID           = (int)dr["ID"];
                        sut.Name         = dr["Name"] as string;
                        sut.Account      = dr["Account"] as string;
                        sut.Pssword      = dr["password"].ToString();
                        sut.Headportrait = dr["Headportrait"] as string;
                        sut.Phone        = dr["Phone"] as string;
                        sut.Email        = dr["Email"] as string;
                        sut.Adress       = dr["Adress"] as string;
                        sut.State        = (int)dr["State"];
                        cus.Add(sut);
                    }
                }
                if (cus.Count == 0)
                {
                    sut    = new customer();
                    sut.ID = -1;
                    cus.Add(sut);
                }

                DBHerpel.CloseConnection();
            }

            return(cus);
        }
Beispiel #4
0
        public List <Commodity> selCommodity(int id)
        {
            List <Model.Commodity> cus = new List <Model.Commodity>();
            Commodity sut = null;

            SqlParameter[] p = { new SqlParameter("@id", id) };
            if (DBHerpel.OpenConnection())
            {
                SqlDataReader dr = DBHerpel.Commodity("proc_Commodity", p);
                if (dr != null)
                {
                    while (dr.Read())
                    {
                        sut                 = new Commodity();
                        sut.ID              = (int)dr["ID"];
                        sut.Commodityname   = dr["Commodityname"] as string;
                        sut.assignor        = (int)dr["assignor"];
                        sut.CommodityTypeID = (int)dr["CommodityTypeID"];
                        sut.Imageurl        = dr["Imageurl"].ToString();
                        sut.transferprice   = Convert.ToDouble(dr["transferprice"]);
                        sut.originalprice   = Convert.ToDouble(dr["originalprice"]);
                        sut.colour          = dr["colour"] as string;
                        sut.Adress          = dr["Adress"] as string;
                        sut.contact         = dr["contact"] as string;
                        sut.commintroduce   = dr["commintroduce"] as string;
                        sut.EditTime        = dr["EditTime"].ToString();
                        sut.browsenum       = (int)dr["browsenum"];
                        sut.State           = (int)dr["State"];
                        sut.Name            = dr["Name"] as string;
                        cus.Add(sut);
                    }
                }
                DBHerpel.CloseConnection();
            }
            return(cus);
        }