/// <summary>
        /// 添加阅览室使用量记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool AddRoomFlowStatistics(RoomFlowStatistics model)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                return(seatService.AddRoomFlowStatistics(model));
            }
            catch (Exception ex)
            {
                error = true;
                WriteLog.Write("添加阅览室使用量记录失败:" + ex.Message);
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RoomFlowStatistics GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,ReadingRoomNo,StatisticsDate,EnterFlow,OutFlow,OnSeat,SelectFlow,ReselectFlow,BespeakCheckFlow,WaitSelectFlow,ShortLeaveFlow,ComeBackFlow,ContinueFlow,LeaveFlow from T_SM_RoomFlowStatistics ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            RoomFlowStatistics model = new RoomFlowStatistics();
            DataSet            ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RoomFlowStatistics model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_SM_RoomFlowStatistics set ");
            strSql.Append("ReadingRoomNo=@ReadingRoomNo,");
            strSql.Append("StatisticsDate=@StatisticsDate,");
            strSql.Append("EnterFlow=@EnterFlow,");
            strSql.Append("OutFlow=@OutFlow,");
            strSql.Append("OnSeat=@OnSeat,");
            strSql.Append("SelectFlow=@SelectFlow,");
            strSql.Append("ReselectFlow=@ReselectFlow,");
            strSql.Append("BespeakCheckFlow=@BespeakCheckFlow,");
            strSql.Append("WaitSelectFlow=@WaitSelectFlow,");
            strSql.Append("ShortLeaveFlow=@ShortLeaveFlow,");
            strSql.Append("ComeBackFlow=@ComeBackFlow,");
            strSql.Append("ContinueFlow=@ContinueFlow,");
            strSql.Append("LeaveFlow=@LeaveFlow");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReadingRoomNo",    SqlDbType.NVarChar,   50),
                new SqlParameter("@StatisticsDate",   SqlDbType.DateTime),
                new SqlParameter("@EnterFlow",        SqlDbType.NVarChar,  200),
                new SqlParameter("@OutFlow",          SqlDbType.NVarChar,  200),
                new SqlParameter("@OnSeat",           SqlDbType.NVarChar,  200),
                new SqlParameter("@SelectFlow",       SqlDbType.NVarChar,  200),
                new SqlParameter("@ReselectFlow",     SqlDbType.NVarChar,  200),
                new SqlParameter("@BespeakCheckFlow", SqlDbType.NVarChar,  200),
                new SqlParameter("@WaitSelectFlow",   SqlDbType.NVarChar,  200),
                new SqlParameter("@ShortLeaveFlow",   SqlDbType.NVarChar,  200),
                new SqlParameter("@ComeBackFlow",     SqlDbType.NVarChar,  200),
                new SqlParameter("@ContinueFlow",     SqlDbType.NVarChar,  200),
                new SqlParameter("@LeaveFlow",        SqlDbType.NVarChar,  200),
                new SqlParameter("@id",               SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.ReadingRoomNo;
            parameters[1].Value  = model.StatisticsDate;
            parameters[2].Value  = model.EnterFlow;
            parameters[3].Value  = model.OutFlow;
            parameters[4].Value  = model.OnSeat;
            parameters[5].Value  = model.SelectFlow;
            parameters[6].Value  = model.ReselectFlow;
            parameters[7].Value  = model.BespeakCheckFlow;
            parameters[8].Value  = model.WaitSelectFlow;
            parameters[9].Value  = model.ShortLeaveFlow;
            parameters[10].Value = model.ComeBackFlow;
            parameters[11].Value = model.ContinueFlow;
            parameters[12].Value = model.LeaveFlow;
            parameters[13].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RoomFlowStatistics DataRowToModel(DataRow row)
        {
            RoomFlowStatistics model = new RoomFlowStatistics();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["ReadingRoomNo"] != null)
                {
                    model.ReadingRoomNo = row["ReadingRoomNo"].ToString();
                }
                if (row["StatisticsDate"] != null && row["StatisticsDate"].ToString() != "")
                {
                    model.StatisticsDate = DateTime.Parse(row["StatisticsDate"].ToString());
                }
                if (row["EnterFlow"] != null)
                {
                    model.EnterFlow = row["EnterFlow"].ToString();
                }
                if (row["OutFlow"] != null)
                {
                    model.OutFlow = row["OutFlow"].ToString();
                }
                if (row["OnSeat"] != null)
                {
                    model.OnSeat = row["OnSeat"].ToString();
                }
                if (row["SelectFlow"] != null)
                {
                    model.SelectFlow = row["SelectFlow"].ToString();
                }
                if (row["ReselectFlow"] != null)
                {
                    model.ReselectFlow = row["ReselectFlow"].ToString();
                }
                if (row["BespeakCheckFlow"] != null)
                {
                    model.BespeakCheckFlow = row["BespeakCheckFlow"].ToString();
                }
                if (row["WaitSelectFlow"] != null)
                {
                    model.WaitSelectFlow = row["WaitSelectFlow"].ToString();
                }
                if (row["ShortLeaveFlow"] != null)
                {
                    model.ShortLeaveFlow = row["ShortLeaveFlow"].ToString();
                }
                if (row["ComeBackFlow"] != null)
                {
                    model.ComeBackFlow = row["ComeBackFlow"].ToString();
                }
                if (row["ContinueFlow"] != null)
                {
                    model.ContinueFlow = row["ContinueFlow"].ToString();
                }
                if (row["LeaveFlow"] != null)
                {
                    model.LeaveFlow = row["LeaveFlow"].ToString();
                }
            }
            return(model);
        }