예제 #1
0
        private List <Room> getAllRoomsFromExcel(String roomTypeNo)
        {
            List <Room> results   = new List <Room>();
            String      condition = "";

            if (!MyStringUtil.isEmpty(roomTypeNo))
            {
                condition = "[房型编号]='" + roomTypeNo + "'";
            }

            DataSet ds = ExcelUtil.ExcelToDS("Sheet2", condition);

            if (ds != null)
            {
                foreach (DataRow mDr in ds.Tables[0].Rows)
                {
                    Room rt = new Room()
                    {
                        type = new RoomType()
                        {
                            type = (mDr["房型编号"].Equals(DBNull.Value)) ? "" : (String)mDr["房型编号"],
                        },
                        roomNumber = (mDr["房号"].Equals(DBNull.Value)) ? "" : (String)mDr["房号"],
                        location   = (mDr["所在地址"].Equals(DBNull.Value)) ? "" : (String)mDr["所在地址"],
                        comments   = (mDr["房型特征"].Equals(DBNull.Value)) ? "" : (String)mDr["房型特征"],
                        price      = (mDr["单价"].Equals(DBNull.Value)) ? 0 : (Double)mDr["单价"],
                        //state = (mDr["当前状态"].Equals(DBNull.Value)) ? "" : (String)mDr["当前状态"]
                        state = Room.RoomState.VACANT
                    };
                    results.Add(rt);
                }
            }
            return(results);
        }
예제 #2
0
        private List <RoomType> getRoomTypesFromExcel()
        {
            List <RoomType> results = new List <RoomType>();
            DataSet         ds      = ExcelUtil.ExcelToDS("Sheet1", "");

            if (ds != null)
            {
                foreach (DataRow mDr in ds.Tables[0].Rows)
                {
                    RoomType rt = new RoomType()
                    {
                        type        = (mDr["房型编号"].Equals(DBNull.Value)) ? "" : (String)mDr["房型编号"],
                        description = (mDr["房型名称"].Equals(DBNull.Value)) ? "" : (String)mDr["房型名称"],
                        remarks     = (mDr["房型特征"].Equals(DBNull.Value)) ? "" : (String)mDr["房型特征"],
                        price       = (mDr["单价"].Equals(DBNull.Value)) ? 0 : (Double)mDr["单价"],
                        status      = (mDr["当前状态"].Equals(DBNull.Value)) ? "" : (String)mDr["当前状态"]
                    };
                    results.Add(rt);
                }
            }
            return(results);
        }