Exemplo n.º 1
0
        private ReadingRoomSeatUsedState_Ex DataRowToReadingRoomSeatUsedState(DataRow dr)
        {
            ReadingRoomSeatUsedState_Ex state = new ReadingRoomSeatUsedState_Ex();

            state.ReadingRoom      = new ReadingRoomInfo();
            state.ReadingRoom.No   = dr["ReadingRoomNo"].ToString();
            state.ReadingRoom.Name = dr["ReadingRoomName"].ToString();
            if (!String.IsNullOrEmpty(dr["ReadingSetting"].ToString()))
            {
                state.ReadingRoom.Setting = new ReadingRoomSetting(dr["ReadingSetting"].ToString());
            }
            else
            {
                state.ReadingRoom.Setting = new ReadingRoomSetting();
            }
            if (!string.IsNullOrEmpty(dr["RoomSeat"].ToString()))
            {
                state.ReadingRoom.SeatList = SeatLayout.GetSeatLayout(dr["RoomSeat"].ToString());
            }
            else
            {
                state.ReadingRoom.SeatList = new SeatLayout();
            }
            state.ReadingRoom.Libaray.No          = dr["LibraryNo"].ToString();
            state.ReadingRoom.Libaray.Name        = dr["LibraryName"].ToString();
            state.ReadingRoom.Libaray.School.No   = dr["SchoolNo"].ToString();
            state.ReadingRoom.Libaray.School.Name = dr["SchoolName"].ToString();
            state.ReadingRoom.Libaray.AreaList    = state.ReadingRoom.Libaray.ToList(dr["AreaInfo"].ToString());
            if (dr["AreaName"] != null && !string.IsNullOrEmpty(dr["AreaName"].ToString()))
            {
                foreach (AreaInfo item in state.ReadingRoom.Libaray.AreaList)
                {
                    if (dr["AreaName"].ToString() == item.AreaName)
                    {
                        state.ReadingRoom.Area = item;
                        break;
                    }
                }
            }
            state.SeatAmountUsed   = int.Parse(dr["UsingCount"].ToString());
            state.SeatBookingCount = int.Parse(dr["BespeakCount"].ToString());
            return(state);
        }
Exemplo n.º 2
0
        ///// <summary>
        ///// 批量删除数据
        ///// </summary>
        //public bool DeleteList(string ReadingRoomNolist )
        //{
        //    StringBuilder strSql=new StringBuilder();
        //    strSql.Append("delete from T_SM_ReadingRoom ");
        //    strSql.Append(" where ReadingRoomNo in ("+ReadingRoomNolist + ")  ");
        //    int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}


        ///// <summary>
        ///// 得到一个对象实体
        ///// </summary>
        //public SeatManage.Model.T_SM_ReadingRoom GetModel(string ReadingRoomNo)
        //{

        //    StringBuilder strSql=new StringBuilder();
        //    strSql.Append("select  top 1 ReadingRoomNo,ReadingRoomName,LibraryNo,ReadingSetting,RoomSeat from T_SM_ReadingRoom ");
        //    strSql.Append(" where ReadingRoomNo=@ReadingRoomNo ");
        //    SqlParameter[] parameters = {
        //            new SqlParameter("@ReadingRoomNo", SqlDbType.NVarChar,50)};
        //    parameters[0].Value = ReadingRoomNo;

        //    SeatManage.Model.T_SM_ReadingRoom model=new SeatManage.Model.T_SM_ReadingRoom();
        //    DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
        //    if(ds.Tables[0].Rows.Count>0)
        //    {
        //        if(ds.Tables[0].Rows[0]["ReadingRoomNo"]!=null && ds.Tables[0].Rows[0]["ReadingRoomNo"].ToString()!="")
        //        {
        //            model.ReadingRoomNo=ds.Tables[0].Rows[0]["ReadingRoomNo"].ToString();
        //        }
        //        if(ds.Tables[0].Rows[0]["ReadingRoomName"]!=null && ds.Tables[0].Rows[0]["ReadingRoomName"].ToString()!="")
        //        {
        //            model.ReadingRoomName=ds.Tables[0].Rows[0]["ReadingRoomName"].ToString();
        //        }
        //        if(ds.Tables[0].Rows[0]["LibraryNo"]!=null && ds.Tables[0].Rows[0]["LibraryNo"].ToString()!="")
        //        {
        //            model.LibraryNo=int.Parse(ds.Tables[0].Rows[0]["LibraryNo"].ToString());
        //        }
        //        if(ds.Tables[0].Rows[0]["ReadingSetting"]!=null && ds.Tables[0].Rows[0]["ReadingSetting"].ToString()!="")
        //        {
        //            model.ReadingSetting=ds.Tables[0].Rows[0]["ReadingSetting"].ToString();
        //        }
        //        if(ds.Tables[0].Rows[0]["RoomSeat"]!=null && ds.Tables[0].Rows[0]["RoomSeat"].ToString()!="")
        //        {
        //            model.RoomSeat=ds.Tables[0].Rows[0]["RoomSeat"].ToString();
        //        }
        //        return model;
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}


        /*
         * /// <summary>
         * /// 分页获取数据列表
         * /// </summary>
         * public DataSet GetList(int PageSize,int PageIndex,string strWhere)
         * {
         *  SqlParameter[] parameters = {
         *          new SqlParameter("@tblName", SqlDbType.VarChar, 255),
         *          new SqlParameter("@fldName", SqlDbType.VarChar, 255),
         *          new SqlParameter("@PageSize", SqlDbType.Int),
         *          new SqlParameter("@PageIndex", SqlDbType.Int),
         *          new SqlParameter("@IsReCount", SqlDbType.Bit),
         *          new SqlParameter("@OrderType", SqlDbType.Bit),
         *          new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
         *          };
         *  parameters[0].Value = "T_SM_ReadingRoom";
         *  parameters[1].Value = "ReadingRoomNo";
         *  parameters[2].Value = PageSize;
         *  parameters[3].Value = PageIndex;
         *  parameters[4].Value = 0;
         *  parameters[5].Value = 0;
         *  parameters[6].Value = strWhere;
         *  return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
         * }*/


        public ReadingRoomInfo DataRowToReadingRoomInfo(DataRow dr)
        {
            ReadingRoomInfo roomInfo = new ReadingRoomInfo();

            roomInfo.No   = dr["ReadingRoomNo"].ToString();
            roomInfo.Name = dr["ReadingRoomName"].ToString();
            if (!String.IsNullOrEmpty(dr["ReadingSetting"].ToString()))
            {
                roomInfo.Setting = new ReadingRoomSetting(dr["ReadingSetting"].ToString());
            }
            else
            {
                roomInfo.Setting = new ReadingRoomSetting();
            }
            if (!string.IsNullOrEmpty(dr["RoomSeat"].ToString()))
            {
                roomInfo.SeatList = SeatLayout.GetSeatLayout(dr["RoomSeat"].ToString());
            }
            else
            {
                roomInfo.SeatList = new SeatLayout();
            }
            roomInfo.Libaray.No          = dr["LibraryNo"].ToString();
            roomInfo.Libaray.Name        = dr["LibraryName"].ToString();
            roomInfo.Libaray.School.No   = dr["SchoolNo"].ToString();
            roomInfo.Libaray.School.Name = dr["SchoolName"].ToString();
            roomInfo.Libaray.AreaList    = roomInfo.Libaray.ToList(dr["AreaInfo"].ToString());
            if (dr["AreaName"] != null && !string.IsNullOrEmpty(dr["AreaName"].ToString()))
            {
                foreach (AreaInfo item in roomInfo.Libaray.AreaList)
                {
                    if (dr["AreaName"].ToString() == item.AreaName)
                    {
                        roomInfo.Area = item;
                        break;
                    }
                }
            }
            return(roomInfo);
        }