/// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ReaderTimeAccess set ");
            strSql.Append("ReaderTimeAccessName=@ReaderTimeAccessName,");
            strSql.Append("Mon=@Mon,");
            strSql.Append("Tue=@Tue,");
            strSql.Append("Wed=@Wed,");
            strSql.Append("Thu=@Thu,");
            strSql.Append("Fri=@Fri,");
            strSql.Append("Sat=@Sat,");
            strSql.Append("Sun=@Sun");
            strSql.Append(" where ReaderTimeAccessID=@ReaderTimeAccessID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ReaderTimeAccessName", DbType.String),
                new SQLiteParameter("@Mon",                  DbType.Int32,   4),
                new SQLiteParameter("@Tue",                  DbType.Int32,   4),
                new SQLiteParameter("@Wed",                  DbType.Int32,   4),
                new SQLiteParameter("@Thu",                  DbType.Int32,   4),
                new SQLiteParameter("@Fri",                  DbType.Int32,   4),
                new SQLiteParameter("@Sat",                  DbType.Int32,   4),
                new SQLiteParameter("@Sun",                  DbType.Int32,   4),
                new SQLiteParameter("@ReaderTimeAccessID",   DbType.Int32, 4)
            };
            parameters[0].Value = model.ReaderTimeAccessName;
            parameters[1].Value = model.Mon;
            parameters[2].Value = model.Tue;
            parameters[3].Value = model.Wed;
            parameters[4].Value = model.Thu;
            parameters[5].Value = model.Fri;
            parameters[6].Value = model.Sat;
            parameters[7].Value = model.Sun;
            parameters[8].Value = model.ReaderTimeAccessID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model = new KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess();
     if (row != null)
     {
         if (row["ReaderTimeAccessID"] != null && row["ReaderTimeAccessID"].ToString() != "")
         {
             model.ReaderTimeAccessID = int.Parse(row["ReaderTimeAccessID"].ToString());
         }
         if (row["ReaderTimeAccessName"] != null)
         {
             model.ReaderTimeAccessName = row["ReaderTimeAccessName"].ToString();
         }
         if (row["Mon"] != null && row["Mon"].ToString() != "")
         {
             model.Mon = int.Parse(row["Mon"].ToString());
         }
         if (row["Tue"] != null && row["Tue"].ToString() != "")
         {
             model.Tue = int.Parse(row["Tue"].ToString());
         }
         if (row["Wed"] != null && row["Wed"].ToString() != "")
         {
             model.Wed = int.Parse(row["Wed"].ToString());
         }
         if (row["Thu"] != null && row["Thu"].ToString() != "")
         {
             model.Thu = int.Parse(row["Thu"].ToString());
         }
         if (row["Fri"] != null && row["Fri"].ToString() != "")
         {
             model.Fri = int.Parse(row["Fri"].ToString());
         }
         if (row["Sat"] != null && row["Sat"].ToString() != "")
         {
             model.Sat = int.Parse(row["Sat"].ToString());
         }
         if (row["Sun"] != null && row["Sun"].ToString() != "")
         {
             model.Sun = int.Parse(row["Sun"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ReaderTimeAccess(");
            strSql.Append("ReaderTimeAccessID,ReaderTimeAccessName,Mon,Tue,Wed,Thu,Fri,Sat,Sun)");
            strSql.Append(" values (");
            strSql.Append("@ReaderTimeAccessID,@ReaderTimeAccessName,@Mon,@Tue,@Wed,@Thu,@Fri,@Sat,@Sun)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ReaderTimeAccessID",   DbType.Int32,   4),
                new SQLiteParameter("@ReaderTimeAccessName", DbType.String),
                new SQLiteParameter("@Mon",                  DbType.Int32,   4),
                new SQLiteParameter("@Tue",                  DbType.Int32,   4),
                new SQLiteParameter("@Wed",                  DbType.Int32,   4),
                new SQLiteParameter("@Thu",                  DbType.Int32,   4),
                new SQLiteParameter("@Fri",                  DbType.Int32,   4),
                new SQLiteParameter("@Sat",                  DbType.Int32,   4),
                new SQLiteParameter("@Sun",                  DbType.Int32, 4)
            };
            parameters[0].Value = model.ReaderTimeAccessID;
            parameters[1].Value = model.ReaderTimeAccessName;
            parameters[2].Value = model.Mon;
            parameters[3].Value = model.Tue;
            parameters[4].Value = model.Wed;
            parameters[5].Value = model.Thu;
            parameters[6].Value = model.Fri;
            parameters[7].Value = model.Sat;
            parameters[8].Value = model.Sun;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess GetModel(int ReaderTimeAccessID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ReaderTimeAccessID,ReaderTimeAccessName,Mon,Tue,Wed,Thu,Fri,Sat,Sun from ReaderTimeAccess ");
            strSql.Append(" where ReaderTimeAccessID=@ReaderTimeAccessID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ReaderTimeAccessID", DbType.Int32, 4)
            };
            parameters[0].Value = ReaderTimeAccessID;

            KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model = new KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess();
            DataSet ds = DbHelperSQLite.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model=new KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess();
     if (row != null)
     {
         if(row["ReaderTimeAccessID"]!=null && row["ReaderTimeAccessID"].ToString()!="")
         {
             model.ReaderTimeAccessID=int.Parse(row["ReaderTimeAccessID"].ToString());
         }
         if(row["ReaderTimeAccessName"]!=null)
         {
             model.ReaderTimeAccessName=row["ReaderTimeAccessName"].ToString();
         }
         if(row["Mon"]!=null && row["Mon"].ToString()!="")
         {
             model.Mon=int.Parse(row["Mon"].ToString());
         }
         if(row["Tue"]!=null && row["Tue"].ToString()!="")
         {
             model.Tue=int.Parse(row["Tue"].ToString());
         }
         if(row["Wed"]!=null && row["Wed"].ToString()!="")
         {
             model.Wed=int.Parse(row["Wed"].ToString());
         }
         if(row["Thu"]!=null && row["Thu"].ToString()!="")
         {
             model.Thu=int.Parse(row["Thu"].ToString());
         }
         if(row["Fri"]!=null && row["Fri"].ToString()!="")
         {
             model.Fri=int.Parse(row["Fri"].ToString());
         }
         if(row["Sat"]!=null && row["Sat"].ToString()!="")
         {
             model.Sat=int.Parse(row["Sat"].ToString());
         }
         if(row["Sun"]!=null && row["Sun"].ToString()!="")
         {
             model.Sun=int.Parse(row["Sun"].ToString());
         }
     }
     return model;
 }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess GetModel(int ReaderTimeAccessID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ReaderTimeAccessID,ReaderTimeAccessName,Mon,Tue,Wed,Thu,Fri,Sat,Sun from ReaderTimeAccess ");
            strSql.Append(" where ReaderTimeAccessID=@ReaderTimeAccessID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@ReaderTimeAccessID", DbType.Int32,4)			};
            parameters[0].Value = ReaderTimeAccessID;

            KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess model=new KryptonAccessController.SQLite.Model.ControllerRelation.ReaderTimeAccess();
            DataSet ds=DbHelperSQLite.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }