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

            strSql.Append("update dbo_Themes set ");
            strSql.Append("dbo_ThemesName=@dbo_ThemesName,");
            strSql.Append("dbo_Ifuse=@dbo_Ifuse");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_ThemesName", OleDbType.VarChar, 50),
                new OleDbParameter("@dbo_Ifuse",      OleDbType.Boolean,  1),
                new OleDbParameter("@ID",             OleDbType.Integer, 4)
            };
            parameters[0].Value = model.dbo_ThemesName;
            parameters[1].Value = model.dbo_Ifuse;
            parameters[2].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public cycms.Model.Themes DataRowToModel(DataRow row)
 {
     cycms.Model.Themes model = new cycms.Model.Themes();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["dbo_ThemesName"] != null)
         {
             model.dbo_ThemesName = row["dbo_ThemesName"].ToString();
         }
         if (row["dbo_Ifuse"] != null && row["dbo_Ifuse"].ToString() != "")
         {
             if ((row["dbo_Ifuse"].ToString() == "1") || (row["dbo_Ifuse"].ToString().ToLower() == "true"))
             {
                 model.dbo_Ifuse = true;
             }
             else
             {
                 model.dbo_Ifuse = false;
             }
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(cycms.Model.Themes model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo_Themes(");
            strSql.Append("dbo_ThemesName,dbo_Ifuse)");
            strSql.Append(" values (");
            strSql.Append("@dbo_ThemesName,@dbo_Ifuse)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_ThemesName", OleDbType.VarChar, 50),
                new OleDbParameter("@dbo_Ifuse",      OleDbType.Boolean, 1)
            };
            parameters[0].Value = model.dbo_ThemesName;
            parameters[1].Value = model.dbo_Ifuse;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public cycms.Model.Themes GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,dbo_ThemesName,dbo_Ifuse from dbo_Themes ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            cycms.Model.Themes model = new cycms.Model.Themes();
            DataSet            ds    = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }