Exemple #1
0
        //
        /// <summary>
        /// 查消费的数量还有总价格
        /// </summary>
        /// <param name="orderId">订单的id</param>
        /// <returns>总数量和总价格</returns>
        public R_OrderInfo_Product GetCountAndMoney(int orderId)
        {
            string              sql    = "select count(*),sum(UnitCount*ProPrice) from R_OrderInfo_Product inner join ProductInfo on ProductInfo.ProId=R_OrderInfo_Product.ProId where R_OrderInfo_Product.DelFlag=0 and OrderId=@OrderId";
            SQLiteDataReader    reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@OrderId", orderId));
            R_OrderInfo_Product rop    = null;

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    rop       = new R_OrderInfo_Product();//这是个大坑
                    rop.CT    = reader.GetInt32(0);
                    rop.MONEY = reader.GetDecimal(1);
                }
            }
            return(rop);
        }
Exemple #2
0
        /// <summary>
        /// 查询会员级别
        /// </summary>
        /// <param name="delFlag">删除标识</param>
        /// <returns>级别对象集合</returns>
        public List <MemmberType> GetAllMemmberTypeByDelFlag(int delFlag)
        {
            string             sql    = "select MemType,MemTpName from MemmberType where DelFlag=@DelFlag";
            SQLiteDataReader   reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@DelFlag", delFlag));
            List <MemmberType> list   = new List <MemmberType>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    MemmberType mt = new MemmberType();
                    mt.MemTpName = reader["MemTpName"].ToString();
                    mt.MemType   = Convert.ToInt32(reader["MemType"]);
                    list.Add(mt);
                }
            }
            return(list);
        }
        /// <summary>
        /// 根据会员id获取会员的级别还有金额还有折扣
        /// </summary>
        /// <param name="memId">会员id</param>
        /// <returns></returns>
        public MemmberInfo GetMemMoneyAndDisCountAndTypeNameByMemId(int memId)
        {
            string           sql    = "select MemTpName,MemDiscount,MemMoney from MemmberInfo inner join MemmberType on MemmberType.MemType=MemmberInfo.MemType where MemmberInfo.DelFlag=0 and MemmberId=@MemmberId";
            SQLiteDataReader reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@MemmberId", memId));
            MemmberInfo      mem    = null;

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    mem             = new MemmberInfo();
                    mem.MemTpName   = reader["MemTpName"].ToString();
                    mem.MemMoney    = Convert.ToDecimal(reader["MemMoney"]);
                    mem.MemDiscount = Convert.ToDecimal(reader["MemDiscount"]);
                }
            }
            return(mem);
        }
Exemple #4
0
        /// <summary>
        /// 根据餐桌id查询该餐桌信息
        /// </summary>
        /// <param name="id">餐桌id</param>
        /// <returns></returns>
        public DeskInfo GetDeskById(int id)
        {
            string           sql    = "select RoomId,DeskName,DeskRemark,DeskRegion from DeskInfo where DelFlag=0 and DeskId=@DeskId";
            SQLiteDataReader reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@DeskId", id));
            DeskInfo         dk     = new DeskInfo();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    dk.DeskName   = reader["DeskName"].ToString();
                    dk.DeskRegion = reader["DeskRegion"].ToString();
                    dk.DeskRemark = reader["DeskRemark"].ToString();
                    dk.RoomId     = Convert.ToInt32(reader["RoomId"]);
                }
            }
            return(dk);
        }
        /// <summary>
        /// 根据id查询房间信息
        /// </summary>
        /// <param name="id">房间id</param>
        /// <returns></returns>
        public RoomInfo GetRoomInfoByRoomId(int id)
        {
            string           sql    = "select RoomName , RoomType ,RoomMinimunConsume ,RoomMaxConsumer, IsDefault  from RoomInfo where DelFlag=0 and RoomId=@RoomId";
            SQLiteDataReader reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@RoomId", id));
            RoomInfo         r      = new RoomInfo();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    r.RoomName           = reader["RoomName"].ToString();
                    r.RoomType           = Convert.ToInt32(reader["RoomType"]);
                    r.RoomMinimunConsume = Convert.ToDecimal(reader["RoomMinimunConsume"]);
                    r.RoomMaxConsumer    = Convert.ToDecimal(reader["RoomMaxConsumer"]);
                    r.IsDefault          = Convert.ToInt32(reader["IsDefault"]);
                }
            }
            return(r);
        }
        /// <summary>
        /// 获取所有房间的名字和id
        /// </summary>
        /// <param name="delFlag">删除标识</param>
        /// <returns></returns>
        public List <RoomInfo> GetRoomNameAndId(int delFlag)
        {
            string           sql    = "select RoomId,RoomName from RoomInfo where DelFlag=@DelFlag";
            SQLiteDataReader reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@DelFlag", delFlag));

            List <RoomInfo> list = new List <RoomInfo>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    RoomInfo r = new RoomInfo();
                    r.RoomId   = Convert.ToInt32(reader["RoomId"]);
                    r.RoomName = reader["RoomName"].ToString();
                    list.Add(r);
                }
            }
            return(list);
        }
Exemple #7
0
        /// <summary>
        /// 根据房间的id获取该房间下的所有的餐桌
        /// </summary>
        /// <param name="roomId">房间的id</param>
        /// <returns>餐桌集合</returns>
        public List <DeskInfo> GetAllDeskInfoByRoomId(int roomId)
        {
            string           sql    = "select DeskId,DeskName,DeskRemark,DeskRegion,DeskState from DeskInfo where DelFlag=0 and RoomId=@RoomId";
            SQLiteDataReader reader = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@RoomId", roomId));
            List <DeskInfo>  list   = new List <DeskInfo>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    DeskInfo dk = new DeskInfo();
                    dk.DeskId     = Convert.ToInt32(reader["DeskId"]);
                    dk.DeskName   = reader["DeskName"].ToString();
                    dk.DeskRegion = reader["DeskRegion"].ToString();
                    dk.DeskRemark = reader["DeskRemark"].ToString();
                    dk.DeskState  = Convert.ToInt32(reader["DeskState"]);
                    list.Add(dk);
                }
            }

            return(list);
        }
        /// <summary>
        /// 根据订单的Id查询总数量和总金额
        /// </summary>
        /// <param name="orderId">订单id</param>
        /// <returns></returns>
        public R_OrderInfo_Product GetMoneyAndCount(int orderId)
        {
            string sql = "select count(*),sum(UnitCount*ProPrice)from R_OrderInfo_Product inner join ProductInfo on R_OrderInfo_Product.ProId=ProductInfo.ProId where OrderId=@OrderId";
            //释放
            SQLiteDataReader sda = SqliteHelper.ExecuteReader(sql, new SQLiteParameter("@OrderId", orderId));

            R_OrderInfo_Product r = null;

            if (sda.HasRows)
            {
                if (sda != null)
                {
                    while (sda.Read())
                    {
                        r       = new R_OrderInfo_Product();
                        r.CT    = Convert.ToInt32(sda[0]);
                        r.MONEY = Convert.ToDecimal(sda[1]);
                    }
                }
            }
            return(r);
        }