Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.ManagerRelation.Manager model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Manager set ");
            strSql.Append("ManagerName=@ManagerName,");
            strSql.Append("ManagerPassWord=@ManagerPassWord,");
            strSql.Append("IsSuperManager=@IsSuperManager");
            strSql.Append(" where ManagerID=@ManagerID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ManagerName",     DbType.String),
                new SQLiteParameter("@ManagerPassWord", DbType.String),
                new SQLiteParameter("@IsSuperManager",  DbType.Boolean,1),
                new SQLiteParameter("@ManagerID",       DbType.Int32, 4)
            };
            parameters[0].Value = model.ManagerName;
            parameters[1].Value = model.ManagerPassWord;
            parameters[2].Value = model.IsSuperManager;
            parameters[3].Value = model.ManagerID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.ManagerRelation.Manager model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Manager(");
            strSql.Append("ManagerID,ManagerName,ManagerPassWord,IsSuperManager)");
            strSql.Append(" values (");
            strSql.Append("@ManagerID,@ManagerName,@ManagerPassWord,@IsSuperManager)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ManagerID",       DbType.Int32,   4),
                new SQLiteParameter("@ManagerName",     DbType.String),
                new SQLiteParameter("@ManagerPassWord", DbType.String),
                new SQLiteParameter("@IsSuperManager",  DbType.Boolean, 1)
            };
            parameters[0].Value = model.ManagerID;
            parameters[1].Value = model.ManagerName;
            parameters[2].Value = model.ManagerPassWord;
            parameters[3].Value = model.IsSuperManager;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ManagerRelation.Manager DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ManagerRelation.Manager model = new KryptonAccessController.SQLite.Model.ManagerRelation.Manager();
     if (row != null)
     {
         if (row["ManagerID"] != null && row["ManagerID"].ToString() != "")
         {
             model.ManagerID = int.Parse(row["ManagerID"].ToString());
         }
         if (row["ManagerName"] != null)
         {
             model.ManagerName = row["ManagerName"].ToString();
         }
         if (row["ManagerPassWord"] != null)
         {
             model.ManagerPassWord = row["ManagerPassWord"].ToString();
         }
         if (row["IsSuperManager"] != null && row["IsSuperManager"].ToString() != "")
         {
             if ((row["IsSuperManager"].ToString() == "1") || (row["IsSuperManager"].ToString().ToLower() == "true"))
             {
                 model.IsSuperManager = true;
             }
             else
             {
                 model.IsSuperManager = false;
             }
         }
     }
     return(model);
 }
Пример #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ManagerRelation.Manager DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ManagerRelation.Manager model=new KryptonAccessController.SQLite.Model.ManagerRelation.Manager();
     if (row != null)
     {
         if(row["ManagerID"]!=null && row["ManagerID"].ToString()!="")
         {
             model.ManagerID=int.Parse(row["ManagerID"].ToString());
         }
         if(row["ManagerName"]!=null)
         {
             model.ManagerName=row["ManagerName"].ToString();
         }
         if(row["ManagerPassWord"]!=null)
         {
             model.ManagerPassWord=row["ManagerPassWord"].ToString();
         }
         if(row["IsSuperManager"]!=null && row["IsSuperManager"].ToString()!="")
         {
             if((row["IsSuperManager"].ToString()=="1")||(row["IsSuperManager"].ToString().ToLower()=="true"))
             {
                 model.IsSuperManager=true;
             }
             else
             {
                 model.IsSuperManager=false;
             }
         }
     }
     return model;
 }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ManagerRelation.Manager GetModel(int ManagerID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ManagerID,ManagerName,ManagerPassWord,IsSuperManager from Manager ");
            strSql.Append(" where ManagerID=@ManagerID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ManagerID", DbType.Int32, 4)
            };
            parameters[0].Value = ManagerID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ManagerRelation.Manager GetModel(int ManagerID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ManagerID,ManagerName,ManagerPassWord,IsSuperManager from Manager ");
            strSql.Append(" where ManagerID=@ManagerID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@ManagerID", DbType.Int32,4)			};
            parameters[0].Value = ManagerID;

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