Exemple #1
0
        public DataTable GetOldBookInfoById(string id)
        {
            DBOperation dbo = new DBOperation();
            string      sql = string.Format("SELECT * FROM OldBookSellInfo WHERE id = '{0}'", id);

            return(dbo.Selectinfo(sql));
        }
Exemple #2
0
        public DataTable GetAllJinhuoqudao()
        {
            DBOperation dbo = new DBOperation();
            string      sql = "SELECT * FROM yg_jinhuoqudao";

            return(dbo.Selectinfo(sql));
        }
Exemple #3
0
        public DataTable GetBookinfoByBookid(string id)
        {
            DBOperation dbo = new DBOperation();
            string      sql = "SELECT id,name,author,press,isbn,price FROM yg_bookinfo WHERE id = '" + id + "'";

            return(dbo.Selectinfo(sql));
        }
Exemple #4
0
        public DataTable SearchBookinfoByIsbn(string isbn)
        {
            DBOperation dbo = new DBOperation();
            string      sql = string.Format("SELECT id,name,author,press,price,isbn FROM yg_bookinfo WHERE ISBN = '{0}'", isbn);
            DataTable   dt  = dbo.Selectinfo(sql);

            return(dt);
        }
Exemple #5
0
        public string GetLocalShopId()
        {
            DBOperation dbo = new DBOperation();
            string      sql = "SELECT * FROM yg_local_shopinfo";
            DataTable   dt  = dbo.Selectinfo(sql);

            if (dt.Rows.Count == 1)
            {
                return(dt.Rows[0]["shopid"].ToString());
            }
            else
            {
                return(null);
            }
        }
Exemple #6
0
        public string GetOrderIdByCreateTime(string time)
        {
            string      sql = string.Format("SELECT id FROM yg_orderinfo WHERE datetime = '{0}'", time);
            DBOperation dbo = new DBOperation();
            DataTable   dt  = dbo.Selectinfo(sql);

            if (dt.Rows.Count != 1)
            {
                this.DebugPrint("获取订单id错误,取到的结果集行数为:" + dt.Rows.Count.ToString());
                return(null);
            }
            else
            {
                return(dt.Rows[0]["id"].ToString());
            }
        }
Exemple #7
0
        public bool InsertOrderDetail(OrderDetail od)
        {
            string sql = string.Format("INSERT INTO yg_orderdetail (orderid,bookid,count,off) VALUES ('{0}','{1}','{2}','{3}')",
                                       od.orderid, od.bookid, od.count, od.off);
            DBOperation dbo = new DBOperation();

            if (1 == dbo.AddDelUpdate(sql))
            {
                sql = string.Format("SELECT * FROM yg_bookstock WHERE bookid = '{0}'", od.bookid);
                DataTable dt = dbo.Selectinfo(sql);
                if (dt.Rows.Count == 0)
                {
                    sql = string.Format("INSERT INTO  yg_bookstock  (bookid , count) VALUES ('{0}','{1}')", od.bookid, od.count);
                    if (1 == dbo.AddDelUpdate(sql))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else if (dt.Rows.Count == 1)
                {
                    sql = string.Format("UPDATE  yg_bookstock  SET count  = count + {0} WHERE bookid = '{1}'", od.count, dt.Rows[0]["bookid"].ToString());
                    if (1 == dbo.AddDelUpdate(sql))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    this.DebugPrint("出现了两本或更多相同bookid的库存信息");
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Exemple #8
0
        public bool InsertNewBookInfo(Localbookinfo bi, out string id)
        {
            id = null;
            string sql = string.Format("INSERT INTO yg_bookinfo (`gbookid`,`name`,`author`,`press`,`price`,`ISBN`,`imgpath`) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",
                                       bi.guid, bi.name, bi.author, bi.press, bi.fixedprice, bi.isbn, bi.imgpath);
            DBOperation dbo = new DBOperation();

            if (1 != dbo.AddDelUpdate(sql))
            {
                return(false);
            }
            sql = string.Format("SELECT id FROM yg_bookinfo WHERE gbookid = '{0}'", bi.guid);
            DataTable dt = dbo.Selectinfo(sql);

            if (dt.Rows.Count > 0)
            {
                id = dt.Rows[0]["id"].ToString();
                return(true);
            }
            return(false);
        }