示例#1
0
        public static void UpdateHTMLModule(HTMLModule module)
        {
            SqlConnection connection   = ConnectionManager.GetDatabaseConnection();
            int           rowsaffected = 0;
            string        procedure    = "UpdateHTMLModule";
            SqlCommand    cmd          = new SqlCommand(procedure, connection);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@ModuleId", SqlDbType.Int).Value         = module.ModuleId;
            cmd.Parameters.Add("@HtmlText", SqlDbType.NText).Value       = module.HtmlText;
            cmd.Parameters.Add("@SearchText", SqlDbType.NText).Value     = module.SearchText;
            cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = module.CreatedDate;

            rowsaffected = cmd.ExecuteNonQuery();
            connection.Close();
        }
示例#2
0
        public static HTMLModule LoadHTMLModuleData(int moduleid)
        {
            SqlConnection connection = ConnectionManager.GetDatabaseConnection();
            HTMLModule    module     = new HTMLModule();
            string        select     = string.Format("SELECT * FROM HTMLTextModule WHERE ModuleId='{0}'", moduleid);
            SqlCommand    cmd        = new SqlCommand(select, connection);

            cmd.CommandType = CommandType.Text;
            SqlDataReader reader;

            reader = cmd.ExecuteReader();
            reader.Read();

            module.HTMLModuleId  = reader.GetInt32(0);
            module.ModuleId      = reader.GetInt32(1);
            module.HtmlText      = reader.GetString(2);
            module.SearchText    = reader.GetString(3);
            module.CreatedByUser = reader.GetString(4);
            module.CreatedDate   = reader.GetDateTime(5);

            connection.Close();
            return(module);
        }