Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update MenuIconInfo set ");
            strSql.Append("MenuIconName=@MenuIconName,");
            strSql.Append("MenuIconCommercial=@MenuIconCommercial,");
            strSql.Append("MenuIconImage=@MenuIconImage");
            strSql.Append(" where MenuIconID=@MenuIconID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@MenuIconName",       DbType.String),
                new SQLiteParameter("@MenuIconCommercial", DbType.Int32, 4),
                new SQLiteParameter("@MenuIconImage",      DbType.Binary),
                new SQLiteParameter("@MenuIconID",         DbType.Int32, 4)
            };
            parameters[0].Value = model.MenuIconName;
            parameters[1].Value = model.MenuIconCommercial;
            parameters[2].Value = model.MenuIconImage;
            parameters[3].Value = model.MenuIconID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into MenuIconInfo(");
            strSql.Append("MenuIconID,MenuIconName,MenuIconCommercial,MenuIconImage)");
            strSql.Append(" values (");
            strSql.Append("@MenuIconID,@MenuIconName,@MenuIconCommercial,@MenuIconImage)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@MenuIconID",         DbType.Int32,   4),
                new SQLiteParameter("@MenuIconName",       DbType.String),
                new SQLiteParameter("@MenuIconCommercial", DbType.Int32,   4),
                new SQLiteParameter("@MenuIconImage",      DbType.Binary)
            };
            parameters[0].Value = model.MenuIconID;
            parameters[1].Value = model.MenuIconName;
            parameters[2].Value = model.MenuIconCommercial;
            parameters[3].Value = model.MenuIconImage;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo model=new KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo();
     if (row != null)
     {
         if(row["MenuIconID"]!=null && row["MenuIconID"].ToString()!="")
         {
             model.MenuIconID=int.Parse(row["MenuIconID"].ToString());
         }
         if(row["MenuIconName"]!=null)
         {
             model.MenuIconName=row["MenuIconName"].ToString();
         }
         if(row["MenuIconCommercial"]!=null && row["MenuIconCommercial"].ToString()!="")
         {
             model.MenuIconCommercial=int.Parse(row["MenuIconCommercial"].ToString());
         }
         if(row["MenuIconImage"]!=null && row["MenuIconImage"].ToString()!="")
         {
             model.MenuIconImage=(byte[])row["MenuIconImage"];
         }
     }
     return model;
 }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo DataRowToModel(DataRow row)
 {
     KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo model = new KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo();
     if (row != null)
     {
         if (row["MenuIconID"] != null && row["MenuIconID"].ToString() != "")
         {
             model.MenuIconID = int.Parse(row["MenuIconID"].ToString());
         }
         if (row["MenuIconName"] != null)
         {
             model.MenuIconName = row["MenuIconName"].ToString();
         }
         if (row["MenuIconCommercial"] != null && row["MenuIconCommercial"].ToString() != "")
         {
             model.MenuIconCommercial = int.Parse(row["MenuIconCommercial"].ToString());
         }
         if (row["MenuIconImage"] != null && row["MenuIconImage"].ToString() != "")
         {
             model.MenuIconImage = (byte[])row["MenuIconImage"];
         }
     }
     return(model);
 }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo GetModel(int MenuIconID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select MenuIconID,MenuIconName,MenuIconCommercial,MenuIconImage from MenuIconInfo ");
            strSql.Append(" where MenuIconID=@MenuIconID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@MenuIconID", DbType.Int32, 4)
            };
            parameters[0].Value = MenuIconID;

            KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo model = new KryptonAccessController.SQLite.Model.ManagerRelation.MenuIconInfo();
            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.ManagerRelation.MenuIconInfo GetModel(int MenuIconID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select MenuIconID,MenuIconName,MenuIconCommercial,MenuIconImage from MenuIconInfo ");
            strSql.Append(" where MenuIconID=@MenuIconID ");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@MenuIconID", DbType.Int32,4)			};
            parameters[0].Value = MenuIconID;

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